4bff0a
From 24e6a5d1deac8aae11a6a3a22fb9b71cb77fdb33 Mon Sep 17 00:00:00 2001
4bff0a
From: Lennart Poettering <lennart@poettering.net>
4bff0a
Date: Sat, 8 Dec 2018 20:21:43 +0100
4bff0a
Subject: [PATCH] mount-point: honour AT_SYMLINK_FOLLOW correctly
4bff0a
4bff0a
Fixes: #11092
4bff0a
(cherry picked from commit be24321f3dae91a166166b239954032727439942)
4bff0a
4bff0a
Resolves: #1683319
4bff0a
---
4bff0a
 src/basic/mount-util.c | 2 +-
4bff0a
 1 file changed, 1 insertion(+), 1 deletion(-)
4bff0a
4bff0a
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
4bff0a
index ebe41a4c6c..3670b7f591 100644
4bff0a
--- a/src/basic/mount-util.c
4bff0a
+++ b/src/basic/mount-util.c
4bff0a
@@ -109,7 +109,7 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *mnt_id
4bff0a
         if ((flags & AT_EMPTY_PATH) && isempty(filename))
4bff0a
                 xsprintf(path, "/proc/self/fdinfo/%i", fd);
4bff0a
         else {
4bff0a
-                subfd = openat(fd, filename, O_CLOEXEC|O_PATH);
4bff0a
+                subfd = openat(fd, filename, O_CLOEXEC|O_PATH|(flags & AT_SYMLINK_FOLLOW ? 0 : O_NOFOLLOW));
4bff0a
                 if (subfd < 0)
4bff0a
                         return -errno;
4bff0a