X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fmkdir-label.c;h=a3bced2939e894d55b148f976b6df8c9848e7c26;hb=7b4a8335022121d06336eae363f3d7fcbcac1c45;hp=221dd67eb2f139346370cc21bdd68af34f30261b;hpb=1cfc78c91965df340cdde100ad6cb3ed50b28927;p=elogind.git
diff --git a/src/basic/mkdir-label.c b/src/basic/mkdir-label.c
index 221dd67eb..a3bced293 100644
--- a/src/basic/mkdir-label.c
+++ b/src/basic/mkdir-label.c
@@ -1,9 +1,8 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
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 +18,23 @@
along with systemd; If not, see .
***/
-#include
-#include
-#include
#include
+#include
+#include
-#include "util.h"
-#include "formats-util.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);
+#include "label.h"
+#include "mkdir.h"
- 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);
+#if 0 /// UNNEEDED by elogind
+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);
}