summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-01-01 09:58:17 +0000
committerWez Furlong <wez@php.net>2003-01-01 09:58:17 +0000
commita28eaf64d0795f305644542c819fa34d73e785f1 (patch)
treee3e18ab16b8707a6c464c2735c89259860e46757 /acinclude.m4
parent57b9b0112d7bb3c14db1484883347dad4bbbf215 (diff)
downloadphp-git-a28eaf64d0795f305644542c819fa34d73e785f1.tar.gz
Workaround for glibc 2.2.9x and later "a+" bug that does not seek to EOF for
files fopen()ed with that mode.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m439
1 files changed, 39 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index b86185f6e0..b4380881e4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1455,6 +1455,45 @@ int main(void) {
fi
])
+AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[
+ AC_MSG_CHECKING([for broken libc stdio])
+ AC_TRY_RUN([
+#include <stdio.h>
+int main(int argc, char *argv[])
+{
+ FILE *fp;
+ long position;
+ char *filename = "/tmp/phpglibccheck";
+
+ fp = fopen(filename, "w");
+ if (fp == NULL) {
+ perror("fopen");
+ exit(2);
+ }
+ fputs("foobar", fp);
+ fclose(fp);
+
+ fp = fopen(filename, "a+");
+ position = ftell(fp);
+ fclose(fp);
+ unlink(filename);
+ if (position == 0)
+ return 1;
+ return 0;
+}
+],
+[have_broken_glibc_fopen_append=no],
+[have_broken_glibc_fopen_append=yes ])
+
+ if test "$have_broken_glibc_fopen_append" = "yes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
+ else
+ AC_MSG_RESULT(no)
+ fi
+])
+
+
AC_DEFUN([PHP_FOPENCOOKIE],[
AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ])