diff options
-rw-r--r-- | src/basic/fs-util.h | 3 | ||||
-rw-r--r-- | src/core/namespace.c | 2 | ||||
-rw-r--r-- | src/home/homework-cifs.c | 2 | ||||
-rw-r--r-- | src/shared/creds-util.c | 2 | ||||
-rw-r--r-- | src/udev/udev-node.c | 2 | ||||
-rw-r--r-- | src/udev/udev-watch.c | 2 |
6 files changed, 8 insertions, 5 deletions
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 3e2db95304..b050438cd7 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -137,6 +137,9 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_ static inline int open_mkdir_at(int dirfd, const char *path, int flags, mode_t mode) { return open_mkdir_at_full(dirfd, path, flags, 0, mode); } +static inline int open_mkdir(const char *path, int flags, mode_t mode) { + return open_mkdir_at_full(AT_FDCWD, path, flags, 0, mode); +} int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, bool *ret_newly_created); diff --git a/src/core/namespace.c b/src/core/namespace.c index e521dc964c..e96c961c50 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -2805,7 +2805,7 @@ static int make_tmp_prefix(const char *prefix) { /* umask will corrupt this access mode, but that doesn't matter, we need to call chmod() anyway for * the suid bit, below. */ - fd = open_mkdir_at(AT_FDCWD, t, O_EXCL|O_CLOEXEC, 0777); + fd = open_mkdir(t, O_EXCL|O_CLOEXEC, 0777); if (fd < 0) return fd; diff --git a/src/home/homework-cifs.c b/src/home/homework-cifs.c index eb87b37915..edc9a4b274 100644 --- a/src/home/homework-cifs.c +++ b/src/home/homework-cifs.c @@ -133,7 +133,7 @@ int home_setup_cifs( return log_oom(); if (FLAGS_SET(flags, HOME_SETUP_CIFS_MKDIR)) { - setup->root_fd = open_mkdir_at(AT_FDCWD, j, O_CLOEXEC, 0700); + setup->root_fd = open_mkdir(j, O_CLOEXEC, 0700); if (setup->root_fd < 0) return log_error_errno(setup->root_fd, "Failed to create CIFS subdirectory: %m"); } diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c index 986b53bdd6..eaf772bff2 100644 --- a/src/shared/creds-util.c +++ b/src/shared/creds-util.c @@ -478,7 +478,7 @@ int get_credential_host_secret(CredentialSecretFlags flags, struct iovec *ret) { assert(filename); mkdir_parents(dirname, 0755); - dfd = open_mkdir_at(AT_FDCWD, dirname, O_CLOEXEC, 0755); + dfd = open_mkdir(dirname, O_CLOEXEC, 0755); if (dfd < 0) return log_debug_errno(dfd, "Failed to create or open directory '%s': %m", dirname); diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 633fb2a31d..253ffa7b7c 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -375,7 +375,7 @@ static int stack_directory_open(sd_device *dev, const char *slink, int *ret_dirf if (r < 0) return log_device_debug_errno(dev, r, "Failed to create stack directory '%s': %m", dirname); - dirfd = open_mkdir_at(AT_FDCWD, dirname, O_CLOEXEC | O_DIRECTORY | O_NOFOLLOW | O_RDONLY, 0755); + dirfd = open_mkdir(dirname, O_CLOEXEC | O_DIRECTORY | O_NOFOLLOW | O_RDONLY, 0755); if (dirfd < 0) return log_device_debug_errno(dev, dirfd, "Failed to open stack directory '%s': %m", dirname); diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 258eb26a65..1e7b9c04ca 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -192,7 +192,7 @@ int udev_watch_begin(int inotify_fd, sd_device *dev) { if (r < 0) return log_device_debug_errno(dev, r, "Failed to get device ID: %m"); - r = dirfd = open_mkdir_at(AT_FDCWD, "/run/udev/watch", O_CLOEXEC | O_RDONLY, 0755); + r = dirfd = open_mkdir("/run/udev/watch", O_CLOEXEC | O_RDONLY, 0755); if (r < 0) return log_device_debug_errno(dev, r, "Failed to create and open '/run/udev/watch/': %m"); |