]> granicus.if.org Git - strace/commitdiff
tests/chroot.c: use errno2name
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 20:30:25 +0000 (20:30 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 20:52:41 +0000 (20:52 +0000)
tests/chroot.c

index fb12a31647126187c0e1f69188153772b0ec87a0..40300b90436f8c46553c5e1293b7c92cf72267fa 100644 (file)
@@ -11,20 +11,10 @@ int
 main(void)
 {
        static const char sample[] = "chroot.sample";
-       int rc = syscall(__NR_chroot ,sample);
-       const char *errno_text;
-       switch (errno) {
-               case ENOSYS:
-                       errno_text = "ENOSYS";
-                       break;
-               case EPERM:
-                       errno_text = "EPERM";
-                       break;
-               default:
-                       errno_text = "ENOENT";
-       }
-       printf("chroot(\"%s\") = %d %s (%m)\n",
-              sample, rc, errno_text);
+
+       long rc = syscall(__NR_chroot, sample);
+       printf("chroot(\"%s\") = %ld %s (%m)\n",
+              sample, rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;