From: Lennart Poettering Date: Tue, 11 Nov 2025 10:35:16 +0000 (+0100) Subject: fs-util: enable automatic access mode logic in xopenat() X-Git-Tag: v259-rc1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0712316e8ee36992706888afa9109dfb058761cb;p=thirdparty%2Fsystemd.git fs-util: enable automatic access mode logic in xopenat() --- diff --git a/src/basic/chase.c b/src/basic/chase.c index a547043c16c..a90ae41d994 100644 --- a/src/basic/chase.c +++ b/src/basic/chase.c @@ -412,11 +412,9 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int return r; if (FLAGS_SET(flags, CHASE_MKDIR_0755) && (!isempty(todo) || !(flags & (CHASE_PARENT|CHASE_NONEXISTENT)))) { - child = xopenat_full(fd, - first, - O_DIRECTORY|O_CREAT|O_EXCL|O_NOFOLLOW|O_PATH|O_CLOEXEC, - /* xopen_flags = */ 0, - 0755); + child = xopenat(fd, + first, + O_DIRECTORY|O_CREAT|O_EXCL|O_NOFOLLOW|O_PATH|O_CLOEXEC); if (child < 0) return child; } else if (FLAGS_SET(flags, CHASE_PARENT) && isempty(todo)) { diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 5e7ed32a522..b26674d139f 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -128,7 +128,7 @@ int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, b int xopenat_full(int dir_fd, const char *path, int open_flags, XOpenFlags xopen_flags, mode_t mode); static inline int xopenat(int dir_fd, const char *path, int open_flags) { - return xopenat_full(dir_fd, path, open_flags, 0, 0); + return xopenat_full(dir_fd, path, open_flags, 0, MODE_INVALID); } int xopenat_lock_full(int dir_fd, const char *path, int open_flags, XOpenFlags xopen_flags, mode_t mode, LockType locktype, int operation);