Fix implicit declaration of functions. https://bugs.php.net/bug.php?id=80171 https://github.com/php/php-src/commit/aa405b7da270595d349d0596ad31305a41d4b1c0 https://github.com/php/php-src/commit/00ba784a2ce95e009f98e0e6d263634673a3f2e1 --- a/acinclude.m4.orig 2018-12-04 11:23:01.000000000 -0600 +++ b/acinclude.m4 2020-12-30 03:58:55.000000000 -0600 @@ -1225,14 +1225,14 @@ #include #include $1 - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } ],[ @@ -1255,14 +1255,14 @@ #include #include $1 - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } ],[ ac_cv_pread=yes @@ -1363,25 +1363,26 @@ #define _REENTRANT #include #include +#include #ifndef PATH_MAX #define PATH_MAX 1024 #endif -main() { +int main() { DIR *dir; char entry[sizeof(struct dirent)+PATH_MAX]; struct dirent *pentry = (struct dirent *) &entry; dir = opendir("/"); if (!dir) - exit(1); + return 1; if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) { close(dir); - exit(0); + return 0; } close(dir); - exit(1); + return 1; } ],[ ac_cv_what_readdir_r=POSIX @@ -1711,6 +1712,7 @@ AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[ AC_TRY_RUN([ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -1720,7 +1722,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -1794,13 +1796,13 @@ cookie_io_functions_t funcs = {reader, writer, seeker, closer}; -main() { +int main() { struct cookiedata g = { 0 }; FILE *fp = fopencookie(&g, "r", funcs); if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) - exit(0); - exit(1); + return 0; + return 1; } ], [ --- a/build/libtool.m4.orig 2018-12-04 11:22:44.000000000 -0600 +++ b/build/libtool.m4 2020-12-30 03:57:09.000000000 -0600 @@ -978,10 +978,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -997,7 +993,7 @@ else puts (dlerror ()); - exit (status); + return status; }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then --- a/configure.orig 2018-12-04 11:22:44.000000000 -0600 +++ b/configure 2020-12-30 04:00:52.000000000 -0600 @@ -12541,13 +12529,13 @@ cookie_io_functions_t funcs = {reader, writer, seeker, closer}; -main() { +int main() { struct cookiedata g = { 0 }; FILE *fp = fopencookie(&g, "r", funcs); if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) - exit(0); - exit(1); + return 0; + return 1; } @@ -12662,6 +12650,7 @@ /* end confdefs.h. */ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -12671,7 +12660,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -14598,6 +14587,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include #include #include #ifndef AF_INET @@ -14610,11 +14600,11 @@ hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) { - exit(1); + return 1; } if (ai == 0) { - exit(1); + return 1; } pai = ai; @@ -14622,16 +14612,16 @@ while (pai) { if (pai->ai_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ - exit(1); + return 1; } if (pai->ai_addr->sa_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ - exit(1); + return 1; } pai = pai->ai_next; } freeaddrinfo(ai); - exit(0); + return 0; } _ACEOF @@ -15145,25 +15135,26 @@ #define _REENTRANT #include #include +#include #ifndef PATH_MAX #define PATH_MAX 1024 #endif -main() { +int main() { DIR *dir; char entry[sizeof(struct dirent)+PATH_MAX]; struct dirent *pentry = (struct dirent *) &entry; dir = opendir("/"); if (!dir) - exit(1); + return 1; if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) { close(dir); - exit(0); + return 0; } close(dir); - exit(1); + return 1; } _ACEOF @@ -74932,14 +74923,14 @@ #include #include - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } @@ -74974,14 +74965,14 @@ #include #include ssize_t pwrite(int, void *, size_t, off64_t); - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } @@ -75043,14 +75034,14 @@ #include #include - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } _ACEOF @@ -75086,14 +75077,14 @@ #include #include ssize_t pread(int, void *, size_t, off64_t); - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } _ACEOF @@ -79036,6 +79027,8 @@ #include #include +#include +#include int main(int argc, char **argv) { @@ -79153,6 +79146,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79164,9 +79159,9 @@ int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","rl"); - exit(!encrypted || strcmp(encrypted,"rl.3StKT.4T8M")); + return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M"); #else - exit(1); + return 1; #endif } _ACEOF @@ -79201,6 +79196,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79212,9 +79209,9 @@ int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","_J9..rasm"); - exit(!encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc")); + return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc"); #else - exit(1); + return 1; #endif } _ACEOF @@ -79249,6 +79246,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79270,9 +79269,9 @@ strcpy(answer,salt); strcat(answer,"rISCgZzpwk3UhDidwXvin0"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -79307,6 +79306,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79325,9 +79326,9 @@ strcpy(answer,salt); strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -79362,6 +79363,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79379,9 +79382,9 @@ strcpy(answer, salt); strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -79416,6 +79419,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79433,9 +79438,9 @@ strcpy(answer, salt); strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -95204,7 +95209,10 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); } + +#include +int main() {char buf[20]; return sprintf(buf,"testing 123")!=11; } + _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -95554,16 +95562,16 @@ double d = (double) LONG_MIN * LONG_MIN + 2e9; if ((long) d == 2e9 && (long) -d == -2e9) { - exit(0); + return 0; } } else if (sizeof(long) == 8) { double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */ if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */ - exit(0); + return 0; } } - exit(1); + return 1; } _ACEOF @@ -95649,10 +95657,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -95668,7 +95672,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -95882,7 +95886,7 @@ fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros); fclose(fp); - exit(0); + return 0; } _ACEOF @@ -95992,6 +95996,7 @@ #include #include #include +#include #ifndef MAP_ANON # ifdef MAP_ANONYMOUS # define MAP_ANON MAP_ANONYMOUS @@ -101683,10 +101688,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -101702,7 +101703,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -101783,10 +101784,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -101802,7 +101799,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5