php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #75696
Patch try-again revision 2018-08-21 15:07 UTC by cmb@php.net

Patch try-again for POSIX related Bug #75696

Patch version 2018-08-21 15:07 UTC

Return to Bug #75696 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 ext/posix/posix.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 0d8edde4e2..5a2f352e41 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -1081,9 +1081,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;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC