]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Move mkdir_label() to mkdir-label.c 7663/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 16 Dec 2017 12:32:42 +0000 (13:32 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 16 Dec 2017 12:32:42 +0000 (13:32 +0100)
It just seems strange to have it in a different file if mkdir-label.c exists.

src/basic/label.c
src/basic/mkdir-label.c

index 5532c5f598179425c1c6f3c0ba4d7bc473ed6f92..ccf0d412d335cc51bd5cedb0c2fc230441fea0f9 100644 (file)
@@ -41,23 +41,6 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
         return 0;
 }
 
-int mkdir_label(const char *path, mode_t mode) {
-        int r;
-
-        assert(path);
-
-        r = mac_selinux_create_file_prepare(path, S_IFDIR);
-        if (r < 0)
-                return r;
-
-        r = mkdir_errno_wrapper(path, mode);
-        mac_selinux_create_file_clear();
-        if (r < 0)
-                return r;
-
-        return mac_smack_fix(path, false, false);
-}
-
 int symlink_label(const char *old_path, const char *new_path) {
         int r;
 
index 16eb7ce2657a9079eab9e0f12645ed0566eaff19..6f3a46f4674206230a33b9702e83551e01a09a09 100644 (file)
 ***/
 
 #include <stdio.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "label.h"
+#include "macro.h"
 #include "mkdir.h"
+#include "selinux-util.h"
+#include "smack-util.h"
+
+int mkdir_label(const char *path, mode_t mode) {
+        int r;
+
+        assert(path);
+
+        r = mac_selinux_create_file_prepare(path, S_IFDIR);
+        if (r < 0)
+                return r;
+
+        r = mkdir_errno_wrapper(path, mode);
+        mac_selinux_create_file_clear();
+        if (r < 0)
+                return r;
+
+        return mac_smack_fix(path, false, false);
+}
 
 int mkdir_safe_label(const char *path, mode_t mode, uid_t uid, gid_t gid, bool follow_symlink) {
         return mkdir_safe_internal(path, mode, uid, gid, follow_symlink, mkdir_label);