summaryrefslogtreecommitdiff
path: root/coreutils/libcoreutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-10 16:58:49 +0000
committerDenis Vlasenko2007-03-10 16:58:49 +0000
commit49622d784672bf2f7b2fe80589714cdef5adde0c (patch)
tree892bb79b0ef031d729e688d6be4950f6d17f13b9 /coreutils/libcoreutils
parent4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5 (diff)
downloadbusybox-49622d784672bf2f7b2fe80589714cdef5adde0c.zip
busybox-49622d784672bf2f7b2fe80589714cdef5adde0c.tar.gz
selinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> (HitachiSoft)
Diffstat (limited to 'coreutils/libcoreutils')
-rw-r--r--coreutils/libcoreutils/getopt_mk_fifo_nod.c20
1 files changed, 17 insertions, 3 deletions
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;
}