naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
df98bb
From b6ffe7ec63d86c5ac66171d6731068b87e3e7b50 Mon Sep 17 00:00:00 2001
df98bb
From: Lennart Poettering <lennart@poettering.net>
df98bb
Date: Sat, 27 Jun 2020 11:13:01 +0200
df98bb
Subject: [PATCH] mount-util: use UMOUNT_NOFOLLOW in recursive umounter
df98bb
df98bb
When we only want to unmount mount points below some path then it is
df98bb
against our interest to follow symlinks. Hence don't.
df98bb
df98bb
(cherry picked from commit 827ea5212507c3833b6ae14cdf65e446b36b5e05)
df98bb
df98bb
Related: #1885143
df98bb
---
df98bb
 src/basic/mount-util.c | 4 ++--
df98bb
 1 file changed, 2 insertions(+), 2 deletions(-)
df98bb
df98bb
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
df98bb
index 2cf98eaa84..be26bb5ec1 100644
df98bb
--- a/src/basic/mount-util.c
df98bb
+++ b/src/basic/mount-util.c
df98bb
@@ -346,8 +346,8 @@ int umount_recursive(const char *prefix, int flags) {
df98bb
                         if (!path_startswith(path, prefix))
df98bb
                                 continue;
df98bb
 
df98bb
-                        if (umount2(path, flags) < 0) {
df98bb
-                                r = log_debug_errno(errno, "Failed to umount %s: %m", path);
df98bb
+                        if (umount2(path, flags | UMOUNT_NOFOLLOW) < 0) {
df98bb
+                                log_debug_errno(errno, "Failed to umount %s: %m", path);
df98bb
                                 continue;
df98bb
                         }
df98bb