summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2007-01-11 02:33:07 +0000
committerSara Golemon <pollita@php.net>2007-01-11 02:33:07 +0000
commit5e74c607a2bf0d00a850a251cc935e3967ee50f0 (patch)
treee326c3d165ac370eb00b831c2b9fc4f99e097650
parenta95781d9bfc5efd721b6b0444a584088bb284887 (diff)
downloadphp-git-5e74c607a2bf0d00a850a251cc935e3967ee50f0.tar.gz
MFH
-rw-r--r--ext/posix/posix.c12
-rw-r--r--ext/standard/filestat.c2
2 files changed, 7 insertions, 7 deletions
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);