Skip to content

Commit

Permalink
test getgrgid for both gids 0 and 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
fischerling committed Jul 24, 2024
1 parent 34104a8 commit 584495a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions programs/tests/t_grp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ static void __test_getgrgid(void) {
if (getgrgid(1337) != NULL)
errx(EXIT_FAILURE, "Group entry for non-existent gid 1337 found");

if (getgrgid(0) == NULL)
errx(EXIT_FAILURE, "Group entry for gid 0 not found");
int gids[] = {0, 1000};
for (int i = 0; i < sizeof(gids) / sizeof(int); i++) {
if (getgrgid(gids[i]) == NULL)
errx(EXIT_FAILURE, "Group entry for gid %d not found", gids[i]);
}
}

int main(int argc, char *argv[])
Expand Down

0 comments on commit 584495a

Please sign in to comment.