X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/1c262cae409ec55a234c89b3b74a13a77c7f595a..caf8a9b2b301aba06735d403317b75b41df59bfe:/lib/stat.c diff --git a/lib/stat.c b/lib/stat.c index 6c354d1d35..1fc633eeef 100644 --- a/lib/stat.c +++ b/lib/stat.c @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,6 +27,20 @@ #include #undef __need_system_sys_stat_h +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if _GL_WINDOWS_64_BIT_ST_SIZE +# define stat _stati64 +# define REPLACE_FUNC_STAT_DIR 1 +# undef REPLACE_FUNC_STAT_FILE +# elif 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 +#endif + static inline int orig_stat (const char *filename, struct stat *buf) { @@ -34,7 +48,10 @@ orig_stat (const char *filename, struct stat *buf) } /* Specification. */ -#include +/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include + above. */ +#include "sys/stat.h" #include #include @@ -43,6 +60,15 @@ orig_stat (const char *filename, struct stat *buf) #include "dosname.h" #include "verify.h" +#if REPLACE_FUNC_STAT_DIR +# include "pathmax.h" + /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also + have a constant PATH_MAX. */ +# ifndef PATH_MAX +# error "Please port this replacement to your platform" +# endif +#endif + /* Store information about NAME into ST. Work around bugs with trailing slashes. Mingw has other bugs (such as st_ino always being 0 on success) which this wrapper does not work around. But @@ -67,11 +93,6 @@ rpl_stat (char const *name, struct stat *st) } #endif /* REPLACE_FUNC_STAT_FILE */ #if REPLACE_FUNC_STAT_DIR - /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also - have a constant PATH_MAX. */ -# ifndef PATH_MAX -# error "Please port this replacement to your platform" -# endif if (result == -1 && errno == ENOENT) {