diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2021-05-29 11:37:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2021-05-29 11:37:09 +0300 |
| commit | 012918bf11fbc2a94dc2319d15d05595c351b811 (patch) | |
| tree | 85b5ee389c48f586e7b7a30d652bfc93aaf9e7ca | |
| parent | 1ae90c030d5ffc79f74e3938880445a6b8b2412e (diff) | |
| download | make-master.tar.gz | |
In MSVC builds, 'stat' fails when called on files larger than
2GB. Call '_stat64' instead to work around this.
* src/remake.c (STAT): Define to '_stat64' for MSVC builds.
(name_mtime) [WINDOWS32]: Use STAT instead of 'stat'.
Suggested by Makoto Kato <m_kato@ga2.so-net.ne.jp>.
| -rw-r--r-- | src/remake.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/remake.c b/src/remake.c index dc3097c..f7605fc 100644 --- a/src/remake.c +++ b/src/remake.c @@ -35,6 +35,13 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ #endif #ifdef WINDOWS32 #include <io.h> +#include <sys/stat.h> +#if defined(_MSC_VER) && _MSC_VER > 1200 +/* VC7 or later supprots _stat64 to access 64-bit file size. */ +#define STAT _stat64 +#else +#define STAT stat +#endif #endif @@ -1466,7 +1473,11 @@ static FILE_TIMESTAMP name_mtime (const char *name) { FILE_TIMESTAMP mtime; +#if defined(WINDOWS32) + struct STAT st; +#else struct stat st; +#endif int e; #if defined(WINDOWS32) @@ -1498,7 +1509,11 @@ name_mtime (const char *name) tend = &tem[0]; } +#if defined(WINDOWS32) + e = STAT (tem, &st); +#else e = stat (tem, &st); +#endif if (e == 0 && !_S_ISDIR (st.st_mode) && tend < tem + (p - name - 1)) { errno = ENOTDIR; |
