From: Dmitry V. Levin Date: Mon, 5 Sep 2016 13:43:36 +0000 (+0000) Subject: tests: use sprintrc in set_mempolicy.test X-Git-Tag: v4.14~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=746d6eb2e2925f419e6df045306acc97bb1b0d66;p=strace tests: use sprintrc in set_mempolicy.test * tests/set_mempolicy.c (main, print_nodes): Use sprintrc. --- diff --git a/tests/set_mempolicy.c b/tests/set_mempolicy.c index c7364bd7..3802eafa 100644 --- a/tests/set_mempolicy.c +++ b/tests/set_mempolicy.c @@ -58,7 +58,7 @@ print_nodes(const unsigned long maxnode, unsigned int offset) memset(nodemask, 0, size); long rc = syscall(__NR_set_mempolicy, 0, nodemask, maxnode); - int saved_errno = errno; + const char *errstr = sprintrc(rc); fputs("set_mempolicy(MPOL_DEFAULT, ", stdout); @@ -88,13 +88,7 @@ print_nodes(const unsigned long maxnode, unsigned int offset) printf("[]"); } - printf(", %lu) = ", maxnode); - if (rc) { - errno = saved_errno; - printf("%ld %s (%m)\n", rc, errno2name()); - } else { - puts("0"); - } + printf(", %lu) = %s\n", maxnode, errstr); } static void @@ -135,8 +129,8 @@ main(void) const unsigned long *nodemask = (void *) 0xfacefeedfffffffe; const unsigned long maxnode = (unsigned long) 0xcafef00dbadc0ded; long rc = syscall(__NR_set_mempolicy, 1, nodemask, maxnode); - printf("set_mempolicy(MPOL_PREFERRED, %p, %lu) = %ld %s (%m)\n", - nodemask, maxnode, rc, errno2name()); + printf("set_mempolicy(MPOL_PREFERRED, %p, %lu) = %s\n", + nodemask, maxnode, sprintrc(rc)); test_offset(0); test_offset(1);