]> granicus.if.org Git - strace/commitdiff
tests: use sprintrc in tests/xchownx.c
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 17 Sep 2016 23:30:01 +0000 (23:30 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Sep 2016 19:51:37 +0000 (19:51 +0000)
* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.

tests/xchownx.c

index b065675b5c54b5b23951c9f912b7b1954e007c9e..fe5828351d5b65e2a856a2b9ede123c724afa597 100644 (file)
@@ -27,7 +27,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -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 +++");