Print

Print


There are 2 issues:

1.  The code is currently checking if "errno" is == ERANGE, but getgrgid_r is thread safe and returns the error code.

2.  Even if getgrgid_r succeeds, the code needs to check the value of gEnt since it may be NULL.


From http://pubs.opengroup.org/onlinepubs/009695299/functions/getgrgid.html

> int getgrgid_r(gid_t gid, struct group *grp, char *buffer,
       size_t bufsize, struct group **result);
> ...
> The getgrgid_r() function shall update the group structure pointed to by grp and store a pointer to that structure at the location pointed to by result.... A NULL pointer shall be returned at the location pointed to by result on error or if the requested entry is not found.

---
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/issues/51

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1