]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount-util: make path_get_mount_info_at() also read utab
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Jan 2025 17:35:21 +0000 (02:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Jan 2025 22:02:48 +0000 (07:02 +0900)
As "_netdev" is only stored in utab.

Fixes a bug introduced by 5261c521e3a98932241f36e91cf6f7823c578aca.
Fixes #35949.

src/shared/mount-util.c

index 9e2d70b30aa5b8c24b3fb1828893fb24ae983d68..720965c46e8ae15cdfaddef6a82312cd7ed92bc1 100644 (file)
@@ -1894,7 +1894,9 @@ static int path_get_mount_info_at(
         if (r < 0)
                 return log_debug_errno(r, "Failed to get mount ID: %m");
 
-        r = libmount_parse("/proc/self/mountinfo", NULL, &table, &iter);
+        /* When getting options is requested, do not pass filename, otherwise utab will not read, and
+         * userspace options like "_netdev" will be lost. */
+        r = libmount_parse(ret_options ? NULL : "/proc/self/mountinfo", /* source = */ NULL, &table, &iter);
         if (r < 0)
                 return log_debug_errno(r, "Failed to parse /proc/self/mountinfo: %m");