From: Sara Golemon Date: Thu, 11 Jan 2007 01:52:24 +0000 (+0000) Subject: Some platforms have getpwnam_r() but are missing _SC_GETPW_R_SIZE_MAX X-Git-Tag: RELEASE_1_0_0RC1~308 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ed43390005d4e35916bc6ed17dbd25e1afaec0a;p=php Some platforms have getpwnam_r() but are missing _SC_GETPW_R_SIZE_MAX --- diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 7809e48bf5..3b8ab338c9 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -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; @@ -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); diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 8cfbdce88b..9e5a710412 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -521,7 +521,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) if (Z_TYPE_P(user) == IS_LONG) { uid = (uid_t)Z_LVAL_P(user); } else { -#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);