]> granicus.if.org Git - strace/commitdiff
tests/ioperm.c: use errno2name
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 20:59:26 +0000 (20:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 22:05:55 +0000 (22:05 +0000)
tests/ioperm.c

index 114c01e71f4a489d94fee47e6337fe3fcc56a4f5..1deaa156caf772f429e01494922663b7cf666567 100644 (file)
@@ -11,23 +11,10 @@ int
 main(void)
 {
        const unsigned long port = (unsigned long) 0xdeafbeefffffffff;
+
        long rc = syscall(__NR_ioperm, port, 1, 0);
-       const char *error_text;
-       switch (errno) {
-               case EIO:
-                       error_text = "EIO";
-                       break;
-               case ENOSYS:
-                       error_text = "ENOSYS";
-                       break;
-               case EPERM:
-                       error_text = "EPERM";
-                       break;
-               default:
-                       error_text = "EINVAL";
-       }
        printf("ioperm(%#lx, %#lx, %d) = %ld %s (%m)\n",
-              port, 1UL, 0, rc, error_text);
+              port, 1UL, 0, rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;