@@ -932,7 +932,7 @@ PHP_FUNCTION(posix_getpwnam)
932
932
struct passwd * pw ;
933
933
char * name ;
934
934
int name_len ;
935
- #ifdef HAVE_GETPWNAM_R
935
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWNAM_R )
936
936
struct passwd pwbuf ;
937
937
int buflen ;
938
938
char * buf ;
@@ -942,7 +942,7 @@ PHP_FUNCTION(posix_getpwnam)
942
942
RETURN_FALSE ;
943
943
}
944
944
945
- #ifdef HAVE_GETPWNAM_R
945
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWNAM_R )
946
946
buflen = sysconf (_SC_GETPW_R_SIZE_MAX );
947
947
buf = emalloc (buflen );
948
948
pw = & pwbuf ;
@@ -965,7 +965,7 @@ PHP_FUNCTION(posix_getpwnam)
965
965
php_error_docref (NULL TSRMLS_CC , E_WARNING , "unable to convert posix passwd struct to array" );
966
966
RETVAL_FALSE ;
967
967
}
968
- #ifdef HAVE_GETPWNAM_R
968
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWNAM_R )
969
969
efree (buf );
970
970
#endif
971
971
}
@@ -976,7 +976,7 @@ PHP_FUNCTION(posix_getpwnam)
976
976
PHP_FUNCTION (posix_getpwuid )
977
977
{
978
978
long uid ;
979
- #ifdef HAVE_GETPWUID_R
979
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWUID_R )
980
980
struct passwd _pw ;
981
981
struct passwd * retpwptr = NULL ;
982
982
int pwbuflen ;
@@ -988,7 +988,7 @@ PHP_FUNCTION(posix_getpwuid)
988
988
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "l" , & uid ) == FAILURE ) {
989
989
RETURN_FALSE ;
990
990
}
991
- #ifdef HAVE_GETPWUID_R
991
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWUID_R )
992
992
pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX );
993
993
pwbuf = emalloc (pwbuflen );
994
994
@@ -1012,7 +1012,7 @@ PHP_FUNCTION(posix_getpwuid)
1012
1012
php_error_docref (NULL TSRMLS_CC , E_WARNING , "unable to convert posix passwd struct to array" );
1013
1013
RETVAL_FALSE ;
1014
1014
}
1015
- #ifdef HAVE_GETPWUID_R
1015
+ #if defined( _SC_GETPW_R_SIZE_MAX ) && defined( HAVE_GETPWUID_R )
1016
1016
efree (pwbuf );
1017
1017
#endif
1018
1018
}
0 commit comments