anitazha / rpms / systemd

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