diff options
Diffstat (limited to 'ext/posix/posix.c')
-rw-r--r-- | ext/posix/posix.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 066139df29..27d91f8a6c 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -1074,9 +1074,15 @@ PHP_FUNCTION(posix_getgrnam) RETURN_FALSE; } buf = emalloc(buflen); +try_again: g = &gbuf; if (getgrnam_r(name, g, buf, buflen, &g) || g == NULL) { + if (errno == ERANGE) { + buflen *= 2; + buf = erealloc(buf, buflen); + goto try_again; + } POSIX_G(last_error) = errno; efree(buf); RETURN_FALSE; |