naccyde / rpms / systemd

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