if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
return log_tests_skipped("not privileged");
- if (running_in_chroot() > 0)
+ if (running_in_chroot() != 0)
return log_tests_skipped("running in chroot");
if (enter_cgroup_subroot(NULL) == -ENOMEDIUM)
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
return log_tests_skipped("not running privileged");
- if (detect_container() > 0 || running_in_chroot() > 0)
+ if (detect_container() != 0 || running_in_chroot() != 0)
return log_tests_skipped("Test not supported in a container/chroot, requires udev/uevent notifications");
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);
#define CHECK_PRIV \
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) \
return (void) log_tests_skipped("Not privileged"); \
- if (running_in_chroot() > 0) \
+ if (running_in_chroot() != 0) \
return (void) log_tests_skipped("running in chroot");
TEST(mount_option_mangle) {
/* let's move into our own mount namespace with all propagation from the host turned off, so
* that /proc/self/mountinfo is static and constant for the whole time our test runs. */
- if (running_in_chroot() > 0) {
+ if (running_in_chroot() != 0) {
/* We cannot remount file system with MS_PRIVATE when running in chroot. */
log_notice("Running in chroot, proceeding in originating mount namespace.");
return EXIT_SUCCESS;
return (void) log_tests_skipped("test not available in container");
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
return (void) log_tests_skipped("test requires privileges");
- if (running_in_chroot() > 0)
+ if (running_in_chroot() != 0)
return (void) log_tests_skipped("test not available in chroot()");
_cleanup_free_ char *sfdisk_path = NULL;