Mercurial > hg > octave-lojdl > gnulib-hg
changeset 16781:f3d643af663d
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 14 Apr 2012 22:27:12 +0200 |
parents | 69130722f8b9 |
children | 5bfb81a09948 |
files | ChangeLog doc/posix-functions/stat.texi lib/stat.c m4/stat.m4 |
diffstat | 4 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- a/doc/posix-functions/stat.texi +++ b/doc/posix-functions/stat.texi @@ -15,7 +15,7 @@ @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:
--- a/lib/stat.c +++ b/lib/stat.c @@ -27,6 +27,15 @@ #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) {
--- a/m4/stat.m4 +++ b/m4/stat.m4 @@ -1,4 +1,4 @@ -# serial 8 +# serial 9 # Copyright (C) 2009-2012 Free Software Foundation, Inc. # @@ -23,8 +23,9 @@ 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