From 1caf9f296b9c801440db303c052b41036bb17ccd Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 17 Sep 2016 23:30:01 +0000 Subject: [PATCH] tests: use sprintrc in tests/xchownx.c * tests/xchownx.c (main): Do not include . Use sprintrc. --- tests/xchownx.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/tests/xchownx.c b/tests/xchownx.c index b065675b..fe582835 100644 --- a/tests/xchownx.c +++ b/tests/xchownx.c @@ -27,7 +27,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include @@ -141,29 +140,11 @@ main(void) const long rc = syscall(SYSCALL_NR, SYSCALL_ARG1, tests[i].uid, tests[i].gid); - int saved_errno = errno; - if (rc != expected) { - if (!i && ENOSYS == errno) { - printf("%s(" FMT_ARG1 ", %u, %u)" - " = -1 ENOSYS (%m)\n", - SYSCALL_NAME, SYSCALL_ARG1, uid, gid); - break; - } - perror_msg_and_fail("%s(" FMT_ARG1 - ", %#lx, %#lx) != %ld", - SYSCALL_NAME, SYSCALL_ARG1, - tests[i].uid, tests[i].gid, - expected); - } - + const char *errstr = sprintrc(rc); printf("%s(" FMT_ARG1, SYSCALL_NAME, SYSCALL_ARG1); print_int(unum); print_int(gnum); - errno = saved_errno; - if (expected) - printf(") = %ld %s (%m)\n", expected, errno2name()); - else - printf(") = 0\n"); + printf(") = %s\n", errstr); } puts("+++ exited with 0 +++"); -- 2.40.0