From: Dmitry V. Levin Date: Thu, 21 Apr 2016 21:32:00 +0000 (+0000) Subject: tests/umount.c: use errno2name X-Git-Tag: v4.12~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0df647673a108a048e9706991874eca4fb249763;p=strace tests/umount.c: use errno2name --- diff --git a/tests/umount.c b/tests/umount.c index 9ad88284..d5cde96b 100644 --- a/tests/umount.c +++ b/tests/umount.c @@ -28,10 +28,10 @@ #include "tests.h" #include #include -#include #include #include #include +#include #ifdef __NR_oldumount # define TEST_SYSCALL_STR "oldumount" @@ -48,24 +48,16 @@ int main(void) { static const char sample[] = "umount.sample"; - const char *errno_text; if (mkdir(sample, 0700)) perror_msg_and_fail("mkdir: %s", sample); - (void) syscall(__NR_oldumount, sample); - switch (errno) { - case ENOSYS: - errno_text = "ENOSYS"; - break; - case EPERM: - errno_text = "EPERM"; - break; - default: - errno_text = "EINVAL"; - } - printf("%s(\"%s\") = -1 %s (%m)\n", - TEST_SYSCALL_STR, sample, errno_text); + + long rc = syscall(__NR_oldumount, sample); + printf("%s(\"%s\") = %ld %s (%m)\n", + TEST_SYSCALL_STR, sample, rc, errno2name()); + if (rmdir(sample)) perror_msg_and_fail("rmdir: %s", sample); + puts("+++ exited with 0 +++"); return 0; }