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