From 827ea5212507c3833b6ae14cdf65e446b36b5e05 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 27 Jun 2020 11:13:01 +0200 Subject: [PATCH] mount-util: use UMOUNT_NOFOLLOW in recursive umounter 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 45fdd3b2da..b3fac13f7e 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -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;