c62b8e
From 66d9fcdc342d9d0916099f90a0dcdd7856e944b8 Mon Sep 17 00:00:00 2001
c62b8e
From: Frantisek Sumsal <fsumsal@redhat.com>
c62b8e
Date: Mon, 14 Jan 2019 10:50:45 +0100
c62b8e
Subject: [PATCH] mount-point: honour AT_SYMLINK_FOLLOW correctly
c62b8e
c62b8e
Cherry-picked from: be24321f3dae91a166166b239954032727439942
c62b8e
---
c62b8e
 src/shared/path-util.c | 2 +-
c62b8e
 1 file changed, 1 insertion(+), 1 deletion(-)
c62b8e
c62b8e
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
c62b8e
index fcc591686f..42941335f2 100644
c62b8e
--- a/src/shared/path-util.c
c62b8e
+++ b/src/shared/path-util.c
c62b8e
@@ -484,7 +484,7 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *mnt_id
c62b8e
         if ((flags & AT_EMPTY_PATH) && isempty(filename))
c62b8e
                 xsprintf(path, "/proc/self/fdinfo/%i", fd);
c62b8e
         else {
c62b8e
-                subfd = openat(fd, filename, O_CLOEXEC|O_PATH);
c62b8e
+                subfd = openat(fd, filename, O_CLOEXEC|O_PATH|(flags & AT_SYMLINK_FOLLOW ? 0 : O_NOFOLLOW));
c62b8e
                 if (subfd < 0)
c62b8e
                         return -errno;
c62b8e