diff --git a/src/test/test-execute.c b/src/test/test-execute.c index d043521034..65908bc8fc 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -1612,7 +1612,7 @@ static int intro(void) { 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) diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c index 144f898f3c..76046f98ad 100644 --- a/src/test/test-loop-block.c +++ b/src/test/test-loop-block.c @@ -240,7 +240,7 @@ static int run(int argc, char *argv[]) { 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); diff --git a/src/test/test-mount-util.c b/src/test/test-mount-util.c index 5d352a7df0..7e40ca79ea 100644 --- a/src/test/test-mount-util.c +++ b/src/test/test-mount-util.c @@ -38,7 +38,7 @@ #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) { diff --git a/src/test/test-mountpoint-util.c b/src/test/test-mountpoint-util.c index 04426365f8..d4c830b476 100644 --- a/src/test/test-mountpoint-util.c +++ b/src/test/test-mountpoint-util.c @@ -457,7 +457,7 @@ static int intro(void) { /* 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; diff --git a/src/test/test-reread-partition-table.c b/src/test/test-reread-partition-table.c index c56e44d8ef..33ab36c5f2 100644 --- a/src/test/test-reread-partition-table.c +++ b/src/test/test-reread-partition-table.c @@ -49,7 +49,7 @@ TEST(rereadpt) { 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;