From: Sara Golemon Date: Thu, 11 Jan 2007 02:33:07 +0000 (+0000) Subject: MFH X-Git-Tag: php-5.2.1RC3~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e74c607a2bf0d00a850a251cc935e3967ee50f0;p=php MFH --- diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 19e5ec571e..d3f2311d57 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -932,7 +932,7 @@ PHP_FUNCTION(posix_getpwnam) struct passwd *pw; char *name; int name_len; -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) struct passwd pwbuf; int buflen; char *buf; @@ -942,7 +942,7 @@ PHP_FUNCTION(posix_getpwnam) RETURN_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) buflen = sysconf(_SC_GETPW_R_SIZE_MAX); buf = emalloc(buflen); pw = &pwbuf; @@ -965,7 +965,7 @@ PHP_FUNCTION(posix_getpwnam) php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array"); RETVAL_FALSE; } -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) efree(buf); #endif } @@ -976,7 +976,7 @@ PHP_FUNCTION(posix_getpwnam) PHP_FUNCTION(posix_getpwuid) { long uid; -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) struct passwd _pw; struct passwd *retpwptr = NULL; int pwbuflen; @@ -988,7 +988,7 @@ PHP_FUNCTION(posix_getpwuid) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) { RETURN_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); pwbuf = emalloc(pwbuflen); @@ -1012,7 +1012,7 @@ PHP_FUNCTION(posix_getpwuid) php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array"); RETVAL_FALSE; } -#ifdef HAVE_GETPWUID_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) efree(pwbuf); #endif } diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 9f688a718b..71eb2ebdfc 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -454,7 +454,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) } convert_to_string_ex(filename); if (Z_TYPE_PP(user) == IS_STRING) { -#ifdef HAVE_GETPWNAM_R +#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) struct passwd pw; struct passwd *retpwptr = NULL; int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);