This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi,
I found a problem today when debugging some NSS releated problems.
If somebody calls getgrnam_r (or any other reentrant NSS function),
the return value of the function will be errno if the status is not
NSS_STATUS_SUCCESS.
But in the case of NSS_STATUS_NOTFOUND, no NSS module sets errno,
so the return value is a random value, but should be zero.
Who should set errno in this case? Should all NSS modules set
errno? Or should we explicit return 0 in the getXXbyYY_r functions
for NSS_STATUS_NOTFOUND?
Testcase:
#include <grp.h>
#include <errno.h>
int main ()
{
char buffer[8048];
struct group *result = (void *)12, gbuf;
errno = 211;
int ret = getgrnam_r ("notexistent", &gbuf, buffer, sizeof (buffer),
&result);
printf ("errno=%d, ret=%d, result=%p\n", errno, ret, result);
return 0;
}
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Maxfeldstr. 5 D-90409 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |