This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug manual/18094] New: getgrouplist does not document how to distinguish errors from undersized output buffer
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 09 Mar 2015 05:12:43 +0000
- Subject: [Bug manual/18094] New: getgrouplist does not document how to distinguish errors from undersized output buffer
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18094
Bug ID: 18094
Summary: getgrouplist does not document how to distinguish
errors from undersized output buffer
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: manual
Assignee: unassigned at sourceware dot org
Reporter: bugdal at aerifal dot cx
CC: mtk.manpages at gmail dot com, roland at gnu dot org
The fact that getgrouplist can fail due to errors is not even documented but
obvious due to the fact that it access the nss backend which requires memory
allocation, dlopen, file descriptors, etc. It seems to return -1 in such cases,
but since getgrouplist is not documented to set a meaningful errno value, or
leave errno unchanged, when returning -1 to indicate that the supplied output
buffer was too small, the only way the caller can distinguish these conditions
seems to be by checking whether *ngroups increased. If it did, the buffer was
too small and the call should be retried with a larger buffer. If it did not,
the return value of -1 must be due to an error and errno should perhaps be
checked.
If my reasoning is correct, I believe this should be documented in the manual.
If not, and especially if there's no valid way to distinguish these cases,
perhaps this should be changed to a bug for the interface itself.
--
You are receiving this mail because:
You are on the CC list for the bug.