[PATCH 1/1] coreutil mkdir: ignore -z when selinux is runtime disabled
Matt Weber
matthew.weber at rockwellcollins.com
Mon May 11 14:00:56 UTC 2015
Fixes the case of using mkdir in inittab where a system might boot
with selinux disable during testing and still needs the folders created
by this command for ram mounts, etc before a mount -a. Currently it
errors out and doesn't create the folder.
Signed-off-by: Matthew Weber <matthew.weber at rockwellcollins.com>
---
coreutils/mkdir.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 864edfb..9fb6e7e 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -83,8 +83,11 @@ int mkdir_main(int argc UNUSED_PARAM, char **argv)
flags |= FILEUTILS_VERBOSE;
#if ENABLE_SELINUX
if (opt & 8) {
- selinux_or_die();
- setfscreatecon_or_die(scontext);
+ if (is_selinux_enabled()) {
+ setfscreatecon_or_die(scontext);
+ }
+ else
+ bb_perror_msg("Ignored -Z for [%s]",*(argv+optind));
}
#endif
--
1.9.1
More information about the busybox
mailing list