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.we...@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 _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox