Skip to content

Fix #75696: posix_getgrnam fails to print details of group#3464

Closed
cmb69 wants to merge 1 commit intophp:PHP-7.1from
cmb69:fix-75696
Closed

Fix #75696: posix_getgrnam fails to print details of group#3464
cmb69 wants to merge 1 commit intophp:PHP-7.1from
cmb69:fix-75696

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Aug 24, 2018

According to the POSIX specification of getgrnam_r() the result of
sysconf(_SC_GETGR_R_SIZE_MAX) is an initial value suggested for the
size of the buffer, and ERANGE signals that insufficient storage was
supplied. So if we get ERANGE, we try again with a buffer twice as
big, and so on, instead of failing.

According to the POSIX specification of `getgrnam_r()` the result of
`sysconf(_SC_GETGR_R_SIZE_MAX)` is an initial value suggested for the
size of the buffer, and `ERANGE` signals that insufficient storage was
supplied.  So if we get `ERANGE`, we try again with a buffer twice as
big, and so on, instead of failing.
@smalyshev smalyshev added the Bug label Aug 26, 2018
@cmb69
Copy link
Member Author

cmb69 commented Aug 29, 2018

Unless there'll be objections, I'm going to merge this on the next weekend.

@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Applied via 2677d43.

@php-pulls php-pulls closed this Sep 1, 2018
@cmb69 cmb69 deleted the fix-75696 branch September 1, 2018 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants