From 14fa74f9aaab9dc61889c11479ba47fb133462d6 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 21 Apr 2016 21:19:30 +0000 Subject: [PATCH] tests/seccomp-filter.c: cleanup * tests/seccomp-filter.c (main): Use errno2name, stop using assert. --- tests/seccomp-filter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/seccomp-filter.c b/tests/seccomp-filter.c index 6d39965d..5f5bb025 100644 --- a/tests/seccomp-filter.c +++ b/tests/seccomp-filter.c @@ -52,19 +52,19 @@ main(void) struct sock_filter *const filter = tail_alloc(sizeof(*filter) * N); const void *const efault = tail_alloc(1); struct sock_fprog *const prog = tail_alloc(sizeof(*prog)); + long rc; prog->filter = filter; prog->len = N; - assert(syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -1, prog) == -1); + rc = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -1, prog); printf("seccomp(SECCOMP_SET_MODE_FILTER, %s, {len=%u, filter=%p})" - " = -1 %s (%m)\n", "SECCOMP_FILTER_FLAG_TSYNC|0xfffffffe", - prog->len, prog->filter, - ENOSYS == errno ? "ENOSYS" : "EINVAL"); + " = %ld %s (%m)\n", "SECCOMP_FILTER_FLAG_TSYNC|0xfffffffe", + prog->len, prog->filter, rc, errno2name()); - assert(syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -2L, efault) == -1); - printf("seccomp(SECCOMP_SET_MODE_FILTER, %s, %p) = -1 %s (%m)\n", - "0xfffffffe /* SECCOMP_FILTER_FLAG_??? */", efault, - ENOSYS == errno ? "ENOSYS" : "EINVAL"); + rc = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -2L, efault); + printf("seccomp(SECCOMP_SET_MODE_FILTER, %s, %p) = %ld %s (%m)\n", + "0xfffffffe /* SECCOMP_FILTER_FLAG_??? */", + efault, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; -- 2.40.0