Patch php_FreeBSD_sysconf for Unknown/Other Function Bug #80198
Patch version 2020-10-07 14:30 UTC
Return to Bug #80198 |
Download this patch
Patch Revisions:
Developer: dl@CyberPunk.ru
diff -ur php-7.4.10.orig/ext/posix/posix.c php-7.4.10/ext/posix/posix.c
--- php-7.4.10.orig/ext/posix/posix.c 2020-09-01 16:58:08.000000000 +0300
+++ php-7.4.10/ext/posix/posix.c 2020-10-07 17:26:38.000000000 +0300
@@ -1085,6 +1085,9 @@
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (buflen < 1) buflen = sysconf(_SC_PAGESIZE);
+#endif
if (buflen < 1) {
RETURN_FALSE;
}
@@ -1142,6 +1145,9 @@
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (grbuflen < 1) grbuflen = sysconf(_SC_PAGESIZE);
+#endif
if (grbuflen < 1) {
RETURN_FALSE;
}
@@ -1217,6 +1223,9 @@
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (buflen < 1) buflen = sysconf(_SC_PAGESIZE);
+#endif
if (buflen < 1) {
RETURN_FALSE;
}
@@ -1273,6 +1282,9 @@
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (pwbuflen < 1) pwbuflen = sysconf(_SC_PAGESIZE);
+#endif
if (pwbuflen < 1) {
RETURN_FALSE;
}
diff -ur php-7.4.10.orig/ext/standard/filestat.c php-7.4.10/ext/standard/filestat.c
--- php-7.4.10.orig/ext/standard/filestat.c 2020-09-01 16:58:11.000000000 +0300
+++ php-7.4.10/ext/standard/filestat.c 2020-10-07 17:27:39.000000000 +0300
@@ -303,6 +303,9 @@
struct group gr;
struct group *retgrptr;
long grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (grbuflen < 1) grbuflen = sysconf(_SC_PAGESIZE);
+#endif
char *grbuf;
if (grbuflen < 1) {
@@ -439,6 +442,9 @@
struct passwd pw;
struct passwd *retpwptr = NULL;
long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (pwbuflen < 1) pwbuflen = sysconf(_SC_PAGESIZE);
+#endif
char *pwbuf;
if (pwbuflen < 1) {
diff -ur php-7.4.10.orig/main/fopen_wrappers.c php-7.4.10/main/fopen_wrappers.c
--- php-7.4.10.orig/main/fopen_wrappers.c 2020-09-01 16:58:08.000000000 +0300
+++ php-7.4.10/main/fopen_wrappers.c 2020-10-07 17:06:20.000000000 +0300
@@ -367,6 +367,9 @@
#if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
struct passwd pwstruc;
long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (pwbuflen < 1) pwbuflen = sysconf(_SC_PAGESIZE);
+#endif
char *pwbuf;
if (pwbuflen < 1) {
diff -ur php-7.4.10.orig/main/main.c php-7.4.10/main/main.c
--- php-7.4.10.orig/main/main.c 2020-09-01 16:58:08.000000000 +0300
+++ php-7.4.10/main/main.c 2020-10-07 17:06:16.000000000 +0300
@@ -1487,6 +1487,9 @@
struct passwd _pw;
struct passwd *retpwptr = NULL;
int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+#if defined(__FreeBSD__) && defined(_SC_PAGESIZE)
+ if (pwbuflen < 1) pwbuflen = sysconf(_SC_PAGESIZE);
+#endif
char *pwbuf;
if (pwbuflen < 1) {
|