libbb: do not compile selinux_or_die() if !SELINUX

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2020-12-16 23:00:51 +01:00
parent 39646dce32
commit bb15969333

View File

@ -523,20 +523,20 @@ void FAST_FUNC xfstat(int fd, struct stat *stat_buf, const char *errmsg)
bb_simple_perror_msg_and_die(errmsg); bb_simple_perror_msg_and_die(errmsg);
} }
#if ENABLE_SELINUX
// selinux_or_die() - die if SELinux is disabled. // selinux_or_die() - die if SELinux is disabled.
void FAST_FUNC selinux_or_die(void) void FAST_FUNC selinux_or_die(void)
{ {
#if ENABLE_SELINUX
int rc = is_selinux_enabled(); int rc = is_selinux_enabled();
if (rc == 0) { if (rc == 0) {
bb_simple_error_msg_and_die("SELinux is disabled"); bb_simple_error_msg_and_die("SELinux is disabled");
} else if (rc < 0) { } else if (rc < 0) {
bb_simple_error_msg_and_die("is_selinux_enabled() failed"); bb_simple_error_msg_and_die("is_selinux_enabled() failed");
} }
#else
bb_simple_error_msg_and_die("SELinux support is disabled");
#endif
} }
#else
/* not defined, other code must have no calls to it */
#endif
int FAST_FUNC ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) int FAST_FUNC ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...)
{ {