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.
This commit is contained in:
Lennart Poettering 2020-06-27 11:13:01 +02:00
parent e49ee28522
commit 827ea52125
1 changed files with 2 additions and 3 deletions

View 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;