chiark / gitweb /
smack: rework SMACK label fixing code to follow more closely the semantics of the...
[elogind.git] / src / shared / label.c
index bee96357315836ed2996bb520c9dc2bf83710242..38992be153d585bcddf5c78ffd7c04b49af3b19b 100644 (file)
 #include "util.h"
 
 int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
-        int r = 0;
+        int r, q;
 
-        if (use_selinux()) {
-                r = mac_selinux_fix(path, ignore_enoent, ignore_erofs);
-                if (r < 0)
-                        return r;
-        }
+        r = mac_selinux_fix(path, ignore_enoent, ignore_erofs);
+        q = mac_smack_fix(path, ignore_enoent, ignore_erofs);
 
-        if (use_smack()) {
-                r = mac_smack_relabel_in_dev(path);
-                if (r < 0)
-                        return r;
-        }
+        if (r < 0)
+                return r;
+        if (q < 0)
+                return q;
 
-        return r;
+        return 0;
 }