]> Savannah Git Hosting - gnulib.git/commitdiff
stat: Bypass buggy override in mingw64.
authorBruno Haible <bruno@clisp.org>
Sat, 14 Apr 2012 20:27:12 +0000 (22:27 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Apr 2012 20:27:12 +0000 (22:27 +0200)
* m4/stat.m4 (gl_FUNC_STAT): Update comments.
* lib/stat.c (stat) [mingw64]: Define to _stat.
* doc/posix-functions/stat.texi: Mention mingw64 bug.

ChangeLog
doc/posix-functions/stat.texi
lib/stat.c
m4/stat.m4

index 62cd270cb71bdc02b700492e0cd4d73519417cd5..f2e4b23148adb24bd03461d3fb85bb51fa3376b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-14  Bruno Haible  <bruno@clisp.org>
+
+       stat: Bypass buggy override in mingw64.
+       * m4/stat.m4 (gl_FUNC_STAT): Update comments.
+       * lib/stat.c (stat) [mingw64]: Define to _stat.
+       * doc/posix-functions/stat.texi: Mention mingw64 bug.
+
 2012-04-14  Bruno Haible  <bruno@clisp.org>
 
        pathmax: Fix compilation error on MSVC 9.
index f92d3a6855539a753e3d261e99c3dd00c6bbfb44..33af95d5ba1f17b72c5433dc9ed1c56b217216c6 100644 (file)
@@ -15,7 +15,7 @@ report the size of files or block devices larger than 2 GB.
 @item
 On some platforms, @code{stat("link-to-file/",buf)} succeeds instead
 of failing with @code{ENOTDIR}.
-FreeBSD 7.2, AIX 7.1, Solaris 9.
+FreeBSD 7.2, AIX 7.1, Solaris 9, mingw64.
 @item
 On some platforms, @code{stat(".",buf)} and @code{stat("./",buf)} give
 different results:
index 9ea53c1c0cd5b4f9ed8a776a1ab434f59b88dd29..29acd9a76e584a473935b9fc4f15083e8a49a130 100644 (file)
 #include <sys/stat.h>
 #undef __need_system_sys_stat_h
 
+#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
+    && REPLACE_FUNC_STAT_FILE
+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
+   Bypass it.  */
+# define stat _stat
+# define REPLACE_FUNC_STAT_DIR 1
+# undef REPLACE_FUNC_STAT_FILE
+#endif
+
 static inline int
 orig_stat (const char *filename, struct stat *buf)
 {
index d67dbcdecd88dcf3e5cc33db623bcd72e491ff59..1e0d0dd723acb3a8d87fcc150799a713538465df 100644 (file)
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
 
 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
@@ -23,8 +23,9 @@ AC_DEFUN([gl_FUNC_STAT],
             mingw*) gl_cv_func_stat_dir_slash="guessing no";;
             *) gl_cv_func_stat_dir_slash="guessing yes";;
           esac])])
-  dnl AIX 7.1, Solaris 9 mistakenly succeed on stat("file/")
-  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/")
+  dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
+  dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
+  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
   AC_CACHE_CHECK([whether stat handles trailing slashes on files],
       [gl_cv_func_stat_file_slash],
       [touch conftest.tmp