]> granicus.if.org Git - strace/commitdiff
tests: workaround systemd-nspawn habit of disabling unimplemented syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 25 Sep 2019 01:02:03 +0000 (01:02 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 25 Sep 2019 01:02:03 +0000 (01:02 +0000)
* tests/clone3.c (do_clone3_): Do not assume that unimplemented
syscalls always fail with ENOSYS.

tests/clone3.c

index 69030dbf31daf07288c81e664ff1c3f97ed58b10..5b93eec1832f8e58f06d64d371b90b02f7ed015a 100644 (file)
@@ -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);