diff --git a/src/basic/label.c b/src/basic/label.c index 5532c5f5981..ccf0d412d33 100644 --- a/src/basic/label.c +++ b/src/basic/label.c @@ -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; diff --git a/src/basic/mkdir-label.c b/src/basic/mkdir-label.c index 16eb7ce2657..6f3a46f4674 100644 --- a/src/basic/mkdir-label.c +++ b/src/basic/mkdir-label.c @@ -20,11 +20,32 @@ ***/ #include +#include #include #include #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);