summaryrefslogtreecommitdiff
path: root/test/pwd_grp/getgroups.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-12-15 17:32:57 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-12-15 17:32:57 +0100
commitbff3a664e6a2a367bf159c3089df1fe6f093bfb1 (patch)
tree70caa2c232125143367912b8279ec1b598406f75 /test/pwd_grp/getgroups.c
parentf8e05f3850e51673522216f23533bf7146359dcd (diff)
test: Some more tests under conditionals
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test/pwd_grp/getgroups.c')
-rw-r--r--test/pwd_grp/getgroups.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/pwd_grp/getgroups.c b/test/pwd_grp/getgroups.c
index 5769b180b..c34355215 100644
--- a/test/pwd_grp/getgroups.c
+++ b/test/pwd_grp/getgroups.c
@@ -13,7 +13,6 @@
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
-#include <err.h>
/* The number of errors encountered so far. */
static int problems = 0;
@@ -25,7 +24,7 @@ static void print_group(gid_t gid)
grp = getgrgid(gid);
if (grp == NULL) {
- warn("cannot find name for group ID %u", gid);
+ fprintf(stderr, "cannot find name for group ID %u\n", gid);
problems++;
}
@@ -46,12 +45,14 @@ static int xgetgroups(gid_t gid, int *n_groups, gid_t ** groups)
/* Add 1 just in case max_n_groups is zero. */
g = (gid_t *) malloc(max_n_groups * sizeof(gid_t) + 1);
- if (g == NULL)
- err(EXIT_FAILURE, "out of memory");
+ if (g == NULL) {
+ fprintf(stderr, "out of memory\n");
+ exit(EXIT_FAILURE);
+ }
ng = getgroups(max_n_groups, g);
if (ng < 0) {
- warn("cannot get supplemental group list");
+ fprintf(stderr, "cannot get supplemental group list\n");
++fail;
free(g);
}