From c1dbe052f164b438ef3f4b2a7e9dbf843117813f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 21 Apr 2016 20:59:26 +0000 Subject: [PATCH] tests/ioperm.c: use errno2name --- tests/ioperm.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/ioperm.c b/tests/ioperm.c index 114c01e7..1deaa156 100644 --- a/tests/ioperm.c +++ b/tests/ioperm.c @@ -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; -- 2.40.0