From: Dmitry V. Levin Date: Wed, 25 Sep 2019 01:02:03 +0000 (+0000) Subject: tests: workaround systemd-nspawn habit of disabling unimplemented syscalls X-Git-Tag: v5.3~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45d9a92359b2832be0d30010a3c6d63317c01efb;p=strace tests: workaround systemd-nspawn habit of disabling unimplemented syscalls * tests/clone3.c (do_clone3_): Do not assume that unimplemented syscalls always fail with ENOSYS. --- diff --git a/tests/clone3.c b/tests/clone3.c index 69030dbf..5b93eec1 100644 --- a/tests/clone3.c +++ b/tests/clone3.c @@ -109,13 +109,21 @@ do_clone3_(void *args, kernel_ulong_t size, bool should_fail, int line) "of a clone3() call (%ld instead of %ld)", line, rc, injected_retval); #else - if (should_fail && rc >= 0) - error_msg_and_fail("%d: Unexpected success of a clone3() call", - line); - if (!should_fail && rc < 0 && errno != ENOSYS) - perror_msg_and_fail("%d: Unexpected failure of a clone3() call", - line); + static int unimplemented_error = -1; + + if (should_fail) { + if (rc >= 0) + error_msg_and_fail("%d: Unexpected success" + " of a clone3() call", line); + if (unimplemented_error < 0) + unimplemented_error = + (errno == EINVAL) ? ENOSYS : errno; + } else { + if (rc < 0 && errno != unimplemented_error) + perror_msg_and_fail("%d: Unexpected failure" + " of a clone3() call", line); + } if (!rc) _exit(child_exit_status);