From 8870b9e83142f6b68d6fba953cc41dff34e8f319 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 16 Sep 2016 23:14:40 +0000 Subject: [PATCH] tests/xstatfsx.c: fix potential errno clobbering * tests/xstatfsx.c (main): Use sprintrc. --- tests/xstatfsx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/xstatfsx.c b/tests/xstatfsx.c index 35618663..c5c04be2 100644 --- a/tests/xstatfsx.c +++ b/tests/xstatfsx.c @@ -105,14 +105,16 @@ main(void) print_statfs(".", NULL); long rc = SYSCALL_INVOKE("", -1, 0, sizeof(STRUCT_STATFS)); + const char *errstr = sprintrc(rc); PRINT_SYSCALL_HEADER("", -1, sizeof(STRUCT_STATFS)); - printf("NULL) = %ld %s (%m)\n", rc, errno2name()); + printf("NULL) = %s\n", errstr); #ifdef CHECK_ODD_SIZE const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef; rc = SYSCALL_INVOKE("", -1, addr, sizeof(STRUCT_STATFS) + 1); + errstr = sprintrc(rc); PRINT_SYSCALL_HEADER("", -1, sizeof(STRUCT_STATFS) + 1); - printf("%#lx) = %ld %s (%m)\n", addr, rc, errno2name()); + printf("%#lx) = %s\n", addr, errstr); #endif puts("+++ exited with 0 +++"); -- 2.40.0