diff options
Diffstat (limited to 'src/mkfifo.c')
-rw-r--r-- | src/mkfifo.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mkfifo.c b/src/mkfifo.c index 78ff909cc..a87a393e2 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -22,6 +22,10 @@ #include <sys/types.h> #include <selinux/selinux.h> +#ifdef HAVE_SMACK +# include <sys/smack.h> +#endif + #include "system.h" #include "error.h" #include "modechange.h" @@ -76,6 +80,7 @@ main (int argc, char **argv) int exit_status = EXIT_SUCCESS; int optc; security_context_t scontext = NULL; + int ret = 0; initialize_main (&argc, &argv); set_program_name (argv[0]); @@ -108,7 +113,17 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (scontext && setfscreatecon (scontext) < 0) + if (scontext) + { +#ifdef HAVE_SMACK + if (smack_smackfs_path ()) + ret = smack_set_label_for_self (scontext); + else +#endif + ret = setfscreatecon (scontext); + } + + if (ret < 0) error (EXIT_FAILURE, errno, _("failed to set default file creation context to %s"), quote (scontext)); |