chiark / gitweb /
Move mkdir_label() to mkdir-label.c
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 16 Dec 2017 12:32:42 +0000 (13:32 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:41 +0000 (07:49 +0200)
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 19d2bca10b216e9a9270de72c1fc52372d7e6f4f..0bea2aa39e58715932481a6a358b6d795d0d62cc 100644 (file)
@@ -41,22 +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);
-}
 
 #if 0 /// UNNEEDED by elogind
 int symlink_label(const char *old_path, const char *new_path) {
index 7a2287f4af8b6bc1873b27f2ae420f251e71635a..59ba85b85dc7c0ead1972828180dba952c7f4157 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);