From 49622d784672bf2f7b2fe80589714cdef5adde0c Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 10 Mar 2007 16:58:49 +0000 Subject: selinux support by Yuichi Nakamura (HitachiSoft) --- coreutils/libcoreutils/getopt_mk_fifo_nod.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'coreutils/libcoreutils') diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c index 3a3d341..2e0c274 100644 --- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c +++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c @@ -30,11 +30,25 @@ mode_t getopt_mk_fifo_nod(int argc, char **argv) { mode_t mode = 0666; char *smode = NULL; - - getopt32(argc, argv, "m:", &smode); - if(smode) { +#if ENABLE_SELINUX + security_context_t scontext; +#endif + int opt; + opt = getopt32(argc, argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); + if (opt & 1) { if (bb_parse_mode(smode, &mode)) umask(0); } + +#if ENABLE_SELINUX + if (opt & 2) { + selinux_or_die(); + if (setfscreatecon(scontext)) { + bb_error_msg_and_die("cannot set default file creation context " + "to %s", scontext); + } + } +#endif + return mode; } -- cgit v1.1