]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount-util: use UMOUNT_NOFOLLOW in recursive umounter
authorLennart Poettering <lennart@poettering.net>
Sat, 27 Jun 2020 09:13:01 +0000 (11:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 7 Jul 2020 09:20:42 +0000 (11:20 +0200)
When we only want to unmount mount points below some path then it is
against our interest to follow symlinks. Hence don't.

src/shared/mount-util.c

index 45fdd3b2da754bad4209c085126c5094ecc7a3e1..b3fac13f7ee9cd487c1edd518c8435c0f1de9ca3 100644 (file)
@@ -58,8 +58,8 @@ int umount_recursive(const char *prefix, int flags) {
                         if (!path_startswith(path, prefix))
                                 continue;
 
-                        if (umount2(path, flags) < 0) {
-                                r = log_debug_errno(errno, "Failed to umount %s: %m", path);
+                        if (umount2(path, flags | UMOUNT_NOFOLLOW) < 0) {
+                                log_debug_errno(errno, "Failed to umount %s, ignoring: %m", path);
                                 continue;
                         }
 
@@ -70,7 +70,6 @@ int umount_recursive(const char *prefix, int flags) {
 
                         break;
                 }
-
         } while (again);
 
         return n;