tests: enhance invalid address decoding check in seccomp-strict.test

* tests/seccomp-strict.c (main): Change the type of addr variable
containg the invalid address from unsigned long to kernel_ulong_t,
print it using %#llx format.
This commit is contained in:
Дмитрий Левин 2016-12-28 22:33:38 +00:00
parent 2add5258ec
commit 54f2397c84

View File

@ -41,18 +41,18 @@ main(void)
static const char text1[] =
"seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = 0\n";
static const char text2[] = "+++ exited with 0 +++\n";
const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
const kernel_ulong_t addr = (kernel_ulong_t) 0xfacefeeddeadbeefULL;
long rc;
rc = syscall(__NR_seccomp, -1L, -1L, addr);
printf("seccomp(%#x /* SECCOMP_SET_MODE_??? */, %u, %#lx)"
" = %ld %s (%m)\n", -1, -1, addr, rc, errno2name());
printf("seccomp(%#x /* SECCOMP_SET_MODE_??? */, %u, %#llx)"
" = %s\n", -1, -1, (unsigned long long) addr, sprintrc(rc));
fflush(stdout);
rc = syscall(__NR_seccomp, 0, 0, 0);
if (rc) {
printf("seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL)"
" = %ld %s (%m)\n", rc, errno2name());
printf("seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = %s\n",
sprintrc(rc));
fflush(stdout);
rc = 0;
} else {