chiark / gitweb /
core: fixate show_status earlier, so that we actually print the welcome message
[elogind.git] / src / shared / label.c
index fde39f22594fd08ac1613818a25a29ecd4a65cef..4a26ba9c5d1393a5a14d6981980473a6e2f5db9e 100644 (file)
@@ -20,7 +20,6 @@
 ***/
 
 #include <errno.h>
-#include <sys/stat.h>
 #include <unistd.h>
 #include <malloc.h>
 #include <sys/socket.h>
@@ -384,3 +383,15 @@ skipped:
 #endif
         return bind(fd, addr, addrlen) < 0 ? -errno : 0;
 }
+
+int label_apply(const char *path, const char *label) {
+        int r = 0;
+
+#ifdef HAVE_SELINUX
+        if (!use_selinux())
+                return 0;
+
+        r = setfilecon(path, (char *)label);
+#endif
+        return r;
+}