summaryrefslogtreecommitdiff
path: root/src/basic/mkdir.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-04-27 12:55:56 +0200
committerFranck Bui <fbui@suse.com>2018-07-30 15:54:03 +0200
commit1e9126316fa10f8f1e2d40b90c77fb63fe10f781 (patch)
treec879154ba97f1e023d0908b3e98da1431ae4670c /src/basic/mkdir.c
parent7e531a5265687aef5177b070c36ca4ceab42e768 (diff)
downloadsystemd-1e9126316fa10f8f1e2d40b90c77fb63fe10f781.tar.gz
systemd-1e9126316fa10f8f1e2d40b90c77fb63fe10f781.tar.bz2
systemd-1e9126316fa10f8f1e2d40b90c77fb63fe10f781.zip
basic/label: introduce mkdirat_label()/mkdirat_errno_wrapper() helpers
Diffstat (limited to 'src/basic/mkdir.c')
-rw-r--r--src/basic/mkdir.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
index 6ab1b4422b..4bb65d5838 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -80,6 +80,12 @@ int mkdir_errno_wrapper(const char *pathname, mode_t mode) {
return 0;
}
+int mkdirat_errno_wrapper(int dirfd, const char *pathname, mode_t mode) {
+ if (mkdirat(dirfd, pathname, mode) < 0)
+ return -errno;
+ return 0;
+}
+
int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags) {
return mkdir_safe_internal(path, mode, uid, gid, flags, mkdir_errno_wrapper);
}