From 3fc6bd96d8804916e7fb6f9e311616c675d6f268 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 21 Apr 2016 20:40:49 +0000 Subject: [PATCH 1/1] tests/fchownat.c: use errno2name --- tests/fchownat.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/fchownat.c b/tests/fchownat.c index b1d06f62..542b68c9 100644 --- a/tests/fchownat.c +++ b/tests/fchownat.c @@ -47,24 +47,22 @@ main(void) if (open(sample, O_RDONLY | O_CREAT, 0400) == -1) perror_msg_and_fail("open"); - if (syscall(__NR_fchownat, AT_FDCWD, sample, uid, gid, 0) == 0) { + 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); if (unlink(sample)) perror_msg_and_fail("unlink"); - if (syscall(__NR_fchownat, AT_FDCWD, sample, - -1, -1L, AT_SYMLINK_NOFOLLOW) != -1) - perror_msg_and_fail("fchownat"); + rc = syscall(__NR_fchownat, AT_FDCWD, + sample, -1, -1L, AT_SYMLINK_NOFOLLOW); printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW)" - " = -1 ENOENT (%m)\n", sample); + " = %ld %s (%m)\n", sample, rc, errno2name()); } else { - if (errno != ENOSYS) - perror_msg_and_fail("fchownat"); printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0)" - " = -1 ENOSYS (%m)\n", sample, uid, gid); + " = %ld %s (%m)\n", sample, uid, gid, rc, errno2name()); } puts("+++ exited with 0 +++"); -- 2.40.0