chiark / gitweb /
mkdir: provide all functions with and without selinux label application
[elogind.git] / src / shared / label.c
index 3e5ea6746957ed7482bdb5b806aa4670fb2d60a6..d91257462521348f5d95a364f6bc4eeeeba05f4a 100644 (file)
@@ -263,15 +263,14 @@ void label_free(const char *label) {
 #endif
 }
 
-int label_mkdir(const char *path, mode_t mode) {
+int label_mkdir(const char *path, mode_t mode, bool apply) {
 
         /* Creates a directory and labels it according to the SELinux policy */
-
 #ifdef HAVE_SELINUX
         int r;
         security_context_t fcon = NULL;
 
-        if (!use_selinux() || !label_hnd)
+        if (!apply || !use_selinux() || !label_hnd)
                 goto skipped;
 
         if (path_is_absolute(path))