From: Dmitry V. Levin Date: Tue, 20 Sep 2016 00:48:57 +0000 (+0000) Subject: tests: use sprintrc in tests/fchownat.c X-Git-Tag: v4.14~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99f41c592d66332e20bfec929f1714f187023acd;p=strace tests: use sprintrc in tests/fchownat.c * tests/fchownat.c (main): Use sprintrc. --- diff --git a/tests/fchownat.c b/tests/fchownat.c index 4917fa96..f2f37ae3 100644 --- a/tests/fchownat.c +++ b/tests/fchownat.c @@ -47,22 +47,16 @@ main(void) perror_msg_and_fail("open"); long rc = syscall(__NR_fchownat, AT_FDCWD, sample, uid, gid, 0); - if (rc == 0) { - printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = 0\n", - sample, uid, gid); + printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = %s\n", + sample, uid, gid, sprintrc(rc)); - if (unlink(sample)) - perror_msg_and_fail("unlink"); + if (unlink(sample)) + perror_msg_and_fail("unlink"); - rc = syscall(__NR_fchownat, AT_FDCWD, - sample, -1, -1L, AT_SYMLINK_NOFOLLOW); - - printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW)" - " = %ld %s (%m)\n", sample, rc, errno2name()); - } else { - printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0)" - " = %ld %s (%m)\n", sample, uid, gid, rc, errno2name()); - } + rc = syscall(__NR_fchownat, AT_FDCWD, + sample, -1, -1L, AT_SYMLINK_NOFOLLOW); + printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW) = %s\n", + sample, sprintrc(rc)); puts("+++ exited with 0 +++"); return 0;