ryantimwilson / rpms / systemd

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