From eaebc33220b6cd81e1cb31d2b81244b6b15b8185 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 3 Nov 2025 21:59:34 +0100 Subject: [PATCH] fileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen() in a similar fashion as xopenat_full() --- src/basic/fileio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/fileio.c b/src/basic/fileio.c index a493384c52d..a3860abefbe 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -1011,7 +1011,7 @@ static int xfopenat_regular(int dir_fd, const char *path, const char *mode, int assert(mode); assert(ret); - if (dir_fd == AT_FDCWD && open_flags == 0 && path) + if (dir_fd == AT_FDCWD && path && open_flags == 0) f = fopen(path, mode); else { _cleanup_close_ int fd = -EBADF; @@ -1029,7 +1029,7 @@ static int xfopenat_regular(int dir_fd, const char *path, const char *mode, int if (dir_fd == AT_FDCWD) return -EBADF; - fd = fd_reopen(dir_fd, mode_flags | open_flags); + fd = fd_reopen(dir_fd, (mode_flags | open_flags) & ~O_NOFOLLOW); if (fd < 0) return fd; } -- 2.47.3