Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <D34204CC-14D4-411E-903B-C19A02F3502A@gmail.com>
Date: Tue, 9 Jun 2015 14:59:22 +0200
From: Julien Ramseier <j.ramseier@...il.com>
To: musl@...ts.openwall.com
Subject: getgrgid and errno

Hello,

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);
	perror("getgrgid");
}

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

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

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

-
Julien
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.