diff options
author | Sven Eden <yamakuzure@gmx.net> | 2017-01-03 11:22:56 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-03-14 10:18:46 +0100 |
commit | 5db0e7adf018c82dd63cd21d31dd313dff5561af (patch) | |
tree | 93cc7298b8dfab71966ded0470bf11fbcffe1c29 /src/basic/mkdir-label.c | |
parent | 390fb58fd380304b6a3c185ee076a8dbc87a07fe (diff) |
Prep v224: Major cleanup of unneeded functions and some source files.
Diffstat (limited to 'src/basic/mkdir-label.c')
-rw-r--r-- | src/basic/mkdir-label.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/basic/mkdir-label.c b/src/basic/mkdir-label.c index 221dd67eb..66978413c 100644 --- a/src/basic/mkdir-label.c +++ b/src/basic/mkdir-label.c @@ -3,7 +3,8 @@ /*** This file is part of systemd. - Copyright 2014 Zbigniew Jędrzejewski-Szmek + Copyright 2010 Lennart Poettering + Copyright 2013 Kay Sievers systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -19,32 +20,23 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <fcntl.h> #include <unistd.h> -#include <stdlib.h> #include <stdio.h> -#include "util.h" -#include "formats-util.h" +#include "label.h" +#include "mkdir.h" -int main(int argc, char** argv) { - const char *p = argv[1] ?: "/tmp"; - char *pattern = strjoina(p, "/systemd-test-XXXXXX"); - _cleanup_close_ int fd, fd2; - _cleanup_free_ char *cmd, *cmd2; - - fd = open_tmpfile(p, O_RDWR|O_CLOEXEC); - assert_se(fd >= 0); - - assert_se(asprintf(&cmd, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd) > 0); - system(cmd); - - fd2 = mkostemp_safe(pattern, O_RDWR|O_CLOEXEC); - assert_se(fd >= 0); - assert_se(unlink(pattern) == 0); +int mkdir_safe_label(const char *path, mode_t mode, uid_t uid, gid_t gid) { + return mkdir_safe_internal(path, mode, uid, gid, mkdir_label); +} - assert_se(asprintf(&cmd2, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd2) > 0); - system(cmd2); +/// UNNEEDED by elogind +#if 0 +int mkdir_parents_label(const char *path, mode_t mode) { + return mkdir_parents_internal(NULL, path, mode, mkdir_label); +} +#endif // 0 - return 0; +int mkdir_p_label(const char *path, mode_t mode) { + return mkdir_p_internal(NULL, path, mode, mkdir_label); } |