X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstat.c;h=f888130d26339d141f3bc1372658bfc336c70e83;hb=v0.0-8062-g6b24f60;hp=fe5b1ac4934470305d61419c084b1c31002bf83a;hpb=21c918ecedb2e44a857c1ff2fe2e4964a2f67312;p=gnulib.git diff --git a/lib/stat.c b/lib/stat.c index fe5b1ac49..f888130d2 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-2013 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,7 +27,22 @@ #include #undef __need_system_sys_stat_h -static inline int +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if _GL_WINDOWS_64_BIT_ST_SIZE +# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ +# 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 int orig_stat (const char *filename, struct stat *buf) { return stat (filename, buf); @@ -48,6 +63,8 @@ orig_stat (const char *filename, struct stat *buf) #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 @@ -77,8 +94,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. */ if (result == -1 && errno == ENOENT) {