diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-07-22 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-07-22 08:00:00 +0000 |
commit | dd2b0a7369cd0b9bae946bce601544569e83fce4 (patch) | |
tree | a197f96f915a60ec36adced314f4b59972026ca4 | |
parent | 3915c41f653c398a8c27cecf1fc2e8ffd7a79cc7 (diff) | |
download | strace-dd2b0a7369cd0b9bae946bce601544569e83fce4.tar.gz |
tests: skip pidns tests when NS_GET_USERNS ioctl is not permitted
Treat EPERM as a valid error code for NS_GET_USERNS ioctl.
* tests/pidns.c (check_ns_ioctl): Skip if NS_GET_USERNS ioctl fails with
EPERM.
Resolves: https://github.com/strace/strace/issues/190
-rw-r--r-- | tests/pidns.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/pidns.c b/tests/pidns.c index 53764a05d..1f00e5ed3 100644 --- a/tests/pidns.c +++ b/tests/pidns.c @@ -180,11 +180,18 @@ check_ns_ioctl(void) int userns_fd = ioctl(fd, NS_GET_USERNS); if (userns_fd < 0) { - if (errno == ENOTTY) + switch (errno) { + case ENOTTY: error_msg_and_skip("NS_* ioctl commands are not " "supported by the kernel"); - else + break; + case EPERM: + error_msg_and_skip("NS_* ioctl commands are not " + "permitted by the kernel"); + break; + default: perror_msg_and_fail("ioctl(NS_GET_USERNS)"); + } } close(userns_fd); |