summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/isadmin.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/isadmin.c b/src/isadmin.c
index ebe98ad..8d77f3f 100644
--- a/src/isadmin.c
+++ b/src/isadmin.c
@@ -73,7 +73,15 @@ int _has_system_group_static_(uid_t uid)
/* Get all the gid of the given uid */
- getpwuid_r(myuid, &pwd, buf, sizeof(buf), &userinfo);
+ if (getpwuid_r(myuid, &pwd, buf, sizeof(buf), &userinfo)) {
+ fprintf(stderr, "isadmin ERROR: cannot get password file entry\n");
+ return -1;
+ }
+
+ if (userinfo == NULL) {
+ fprintf(stderr, "isadmin ERROR: no matching password record\n");
+ return -1;
+ }
/* Need to call this function now to get the number of group to make the
malloc correctly sized */