Skip to content

Commit 5e74c60

Browse files
committed
MFH
1 parent a95781d commit 5e74c60

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ext/posix/posix.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ PHP_FUNCTION(posix_getpwnam)
932932
struct passwd *pw;
933933
char *name;
934934
int name_len;
935-
#ifdef HAVE_GETPWNAM_R
935+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
936936
struct passwd pwbuf;
937937
int buflen;
938938
char *buf;
@@ -942,7 +942,7 @@ PHP_FUNCTION(posix_getpwnam)
942942
RETURN_FALSE;
943943
}
944944

945-
#ifdef HAVE_GETPWNAM_R
945+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
946946
buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
947947
buf = emalloc(buflen);
948948
pw = &pwbuf;
@@ -965,7 +965,7 @@ PHP_FUNCTION(posix_getpwnam)
965965
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array");
966966
RETVAL_FALSE;
967967
}
968-
#ifdef HAVE_GETPWNAM_R
968+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
969969
efree(buf);
970970
#endif
971971
}
@@ -976,7 +976,7 @@ PHP_FUNCTION(posix_getpwnam)
976976
PHP_FUNCTION(posix_getpwuid)
977977
{
978978
long uid;
979-
#ifdef HAVE_GETPWUID_R
979+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
980980
struct passwd _pw;
981981
struct passwd *retpwptr = NULL;
982982
int pwbuflen;
@@ -988,7 +988,7 @@ PHP_FUNCTION(posix_getpwuid)
988988
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) {
989989
RETURN_FALSE;
990990
}
991-
#ifdef HAVE_GETPWUID_R
991+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
992992
pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
993993
pwbuf = emalloc(pwbuflen);
994994

@@ -1012,7 +1012,7 @@ PHP_FUNCTION(posix_getpwuid)
10121012
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to convert posix passwd struct to array");
10131013
RETVAL_FALSE;
10141014
}
1015-
#ifdef HAVE_GETPWUID_R
1015+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
10161016
efree(pwbuf);
10171017
#endif
10181018
}

ext/standard/filestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown)
454454
}
455455
convert_to_string_ex(filename);
456456
if (Z_TYPE_PP(user) == IS_STRING) {
457-
#ifdef HAVE_GETPWNAM_R
457+
#if defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
458458
struct passwd pw;
459459
struct passwd *retpwptr = NULL;
460460
int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);

0 commit comments

Comments
 (0)