Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 9 Jun 2015 14:59:22 +0200
From: Julien Ramseier <>
Subject: getgrgid and errno


I’m encountering a strange problem with getgrgid.

Calling this function with a non-existent group sets errno to ENOENT instead of 0.
This small test program below prints getgrgid: No such file or directory.

#include <sys/types.h>
#include <grp.h>
#include <stddef.h>
#include <errno.h>

int main(void) {
	errno = 0;
	struct group *g = getgrgid(1234);

However, when stepping through __getgr_a with gdb, errno seems to be correctly set to 0:

167		if (rv) errno = rv;
168		return rv;
(gdb) p rv
$6 = 0

So I really don’t know what’s going on…Am I missing something?

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.