]> granicus.if.org Git - php/commitdiff
Some platforms have getpwnam_r() but are missing _SC_GETPW_R_SIZE_MAX
authorSara Golemon <pollita@php.net>
Thu, 11 Jan 2007 01:52:24 +0000 (01:52 +0000)
committerSara Golemon <pollita@php.net>
Thu, 11 Jan 2007 01:52:24 +0000 (01:52 +0000)
ext/posix/posix.c
ext/standard/filestat.c

index 7809e48bf5028144fffc1882853ed53f18495423..3b8ab338c9f29b610db559a498e5d8efcf3bbd8a 100644 (file)
@@ -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);
 
index 8cfbdce88bcf4669e7e1cff933e5504501f014bf..9e5a7104124b58e7f108c94e5028fc4bb99aa9c8 100644 (file)
@@ -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);