From: Mike Yuan Date: Mon, 3 Nov 2025 20:59:34 +0000 (+0100) Subject: fileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen() X-Git-Tag: v259-rc1~170^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaebc33220b6cd81e1cb31d2b81244b6b15b8185;p=thirdparty%2Fsystemd.git fileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen() in a similar fashion as xopenat_full() --- 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; }