Skip to content

Commit 74644f8

Browse files
committed
Fix incorrect getgrnam error handling
getgrent(3) says: Note that programs must explicitly set errno to zero before calling any of these functions if they need to distinguish between a non-existent entry and an error. We didn't so we could log the wrong error based on previous failed call and confuse the user. Signed-off-by: Nir Soffer <[email protected]>
1 parent 8513f80 commit 74644f8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ static int socket_bindlisten(const char *socket_path,
348348
goto err;
349349
}
350350
if (socket_group != NULL) {
351+
errno = 0;
351352
struct group *grp = getgrnam(socket_group); /* Do not free */
352353
if (grp == NULL) {
353354
if (errno != 0)

0 commit comments

Comments
 (0)