tests/prctl-seccomp-strict.c: cleanup
* tests/prctl-seccomp-strict.c (main): Use errno2name,
stop using assert.
diff --git a/tests/prctl-seccomp-strict.c b/tests/prctl-seccomp-strict.c
index 8d1fdfc..1944745 100644
--- a/tests/prctl-seccomp-strict.c
+++ b/tests/prctl-seccomp-strict.c
@@ -44,23 +44,24 @@
static const char text1[] =
"prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) = 0\n";
static const char text2[] = "+++ exited with 0 +++\n";
- int rc = 0;
- assert(prctl(PR_SET_SECCOMP, -1L, 1, 2, 3) == -1);
+ int rc = prctl(PR_SET_SECCOMP, -1L, 1, 2, 3);
printf("prctl(PR_SET_SECCOMP, %#x /* SECCOMP_MODE_??? */, 0x1, 0x2, 0x3)"
- " = -1 %s (%m)\n", -1, ENOSYS == errno ? "ENOSYS" : "EINVAL");
+ " = %d %s (%m)\n", -1, rc, errno2name());
fflush(stdout);
- if (prctl(PR_SET_SECCOMP, 1)) {
- printf("prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) = -1 %s (%m)\n",
- ENOSYS == errno ? "ENOSYS" : "EINVAL");
+ rc = prctl(PR_SET_SECCOMP, 1);
+ if (rc) {
+ printf("prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT)"
+ " = %d %s (%m)\n", rc, errno2name());
fflush(stdout);
+ rc = 0;
} else {
/*
* If kernel implementaton of SECCOMP_MODE_STRICT is buggy,
* the following syscall will result to SIGKILL.
*/
- rc += write(1, text1, LENGTH_OF(text1)) != LENGTH_OF(text1);
+ rc = write(1, text1, LENGTH_OF(text1)) != LENGTH_OF(text1);
}
rc += write(1, text2, LENGTH_OF(text2)) != LENGTH_OF(text2);