mountutil: skip empty tokens in mount option parser (#41311)

Removed unused includes and improved option handling in mountflags.cpp.

Eamon committed Aug 12, 2026 at 05:04 UTC 20c0be4b4543b51fca76fce75cf37d1e8dfaceee
1 file changed +5 -4
src/linux/mountutil/mountflags.cpp
+5 -4
@@ -2,13 +2,9 @@
2 #include <string>
3 #include <string_view>
4 #include <cerrno>
5 -#include <cstdio>
6 -#include <functional>
5 #include <sys/types.h>
6 #include <sys/mount.h>
9 -#include <sys/types.h>
7 #include <sys/stat.h>
11 -#include <dirent.h>
8 #include <unistd.h>
9 #include <lxdef.h>
10 #include <lxwil.h>
@@ -142,6 +138,11 @@ ParsedOptions MountParseFlags(std::string_view options)
138 {
139 // Get the next option and check if it's a flag.
140 auto option = NextToken(options, ',');
141 + if (option.empty())
142 + {
143 + continue;
144 + }
145 +
146 auto flag = FindOption(option);
147 if (flag == nullptr)
148 {