summaryrefslogtreecommitdiff
path: root/tests/getgroups.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2016-04-21 20:51:15 +0000
committerDmitry V. Levin <ldv@altlinux.org>2016-04-21 22:05:55 +0000
commit7f68f80f420d4af0cb74371e1673282171ad11d5 (patch)
tree699bb1fe93256d9cf0dcd8e8940ab64d3bcb4ba6 /tests/getgroups.c
parent337f66e7c789b1aa50f47385ead8854078d73375 (diff)
downloadstrace-7f68f80f420d4af0cb74371e1673282171ad11d5.tar.gz
tests/getgroups.c: use errno2name
* tests/getgroups.c (errno2str): Remove. (main): Use errno2name.
Diffstat (limited to 'tests/getgroups.c')
-rw-r--r--tests/getgroups.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/getgroups.c b/tests/getgroups.c
index e853b25c5..c99b70ccd 100644
--- a/tests/getgroups.c
+++ b/tests/getgroups.c
@@ -58,17 +58,6 @@
# include <stdio.h>
# include <unistd.h>
-static const char *
-errno2str(void)
-{
- switch (errno) {
-#define CASE(x) case x: return #x
- CASE(EINVAL);
- CASE(EFAULT);
- default: perror_msg_and_fail(SYSCALL_NAME);
- }
-}
-
#define MAX_STRLEN 32
static long ngroups;
@@ -108,18 +97,18 @@ main(void)
rc = syscall(SYSCALL_NR, -1U, 0);
printf("%s(%u, NULL) = %ld %s (%m)\n",
- SYSCALL_NAME, -1U, rc, errno2str());
+ SYSCALL_NAME, -1U, rc, errno2name());
rc = syscall(SYSCALL_NR, -1L, 0);
printf("%s(%u, NULL) = %ld %s (%m)\n",
- SYSCALL_NAME, -1U, rc, errno2str());
+ SYSCALL_NAME, -1U, rc, errno2name());
const unsigned int ngroups_max = sysconf(_SC_NGROUPS_MAX);
rc = syscall(SYSCALL_NR, ngroups_max, 0);
if (rc < 0)
printf("%s(%u, NULL) = %ld %s (%m)\n",
- SYSCALL_NAME, ngroups_max, rc, errno2str());
+ SYSCALL_NAME, ngroups_max, rc, errno2name());
else
printf("%s(%u, NULL) = %ld\n",
SYSCALL_NAME, ngroups_max, rc);
@@ -127,7 +116,7 @@ main(void)
rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL | ngroups_max, 0);
if (rc < 0)
printf("%s(%u, NULL) = %ld %s (%m)\n",
- SYSCALL_NAME, ngroups_max, rc, errno2str());
+ SYSCALL_NAME, ngroups_max, rc, errno2name());
else
printf("%s(%u, NULL) = %ld\n",
SYSCALL_NAME, ngroups_max, rc);
@@ -147,7 +136,7 @@ main(void)
rc = syscall(SYSCALL_NR, ngroups, efault);
printf("%s(%u, %p) = %ld %s (%m)\n",
SYSCALL_NAME, (unsigned) ngroups, efault,
- rc, errno2str());
+ rc, errno2name());
}
puts("+++ exited with 0 +++");