]> granicus.if.org Git - strace/commitdiff
tests/xstatfsx.c: fix potential errno clobbering
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 16 Sep 2016 23:14:40 +0000 (23:14 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Sep 2016 19:51:37 +0000 (19:51 +0000)
* tests/xstatfsx.c (main): Use sprintrc.

tests/xstatfsx.c

index 35618663b456bc021e012ebcdc52ddc4d3311cc2..c5c04be2f3b48708f14ddfa91cbaeda42bf57e75 100644 (file)
@@ -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 +++");