chiark / gitweb /
label: don't try to create labelled directories more than once
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Oct 2014 17:41:56 +0000 (19:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Oct 2014 19:36:56 +0000 (21:36 +0200)
src/shared/mkdir-label.c

index 81bc78c..8b35386 100644 (file)
 static int label_mkdir(const char *path, mode_t mode) {
         int r;
 
-        if (mac_selinux_use()) {
-                r = mac_selinux_mkdir(path, mode);
-                if (r < 0)
-                        return r;
-        }
+        if (mac_selinux_use())
+                return mac_selinux_mkdir(path, mode);
 
         if (mac_smack_use()) {
                 r = mkdir(path, mode);
-                if (r < 0 && errno != EEXIST)
+                if (r < 0)
                         return -errno;
 
-                r = mac_smack_fix(path, false, false);
-                if (r < 0)
-                        return r;
+                return mac_smack_fix(path, false, false);
         }
 
         r = mkdir(path, mode);
-        if (r < 0 && errno != EEXIST)
+        if (r < 0)
                 return -errno;
 
         return 0;