introduce and use setfscreatecon_or_die
[oweals/busybox.git] / libbb / selinux_common.c
index 70d63a4659f607ed2e5021fa826647c1fc0b1a11..d506f0636ba230100d1cc3084ee8305f8fbdb7d6 100644 (file)
@@ -28,3 +28,13 @@ error:
        context_free(con);
        return NULL;
 }
+
+void setfscreatecon_or_die(security_context_t scontext)
+{
+       if (setfscreatecon(scontext) < 0) {
+               /* Can be NULL. All known printf implementations
+                * display "(null)", "<null>" etc */
+               bb_perror_msg_and_die("cannot set default "
+                               "file creation context to %s", scontext);
+       }
+}