mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-11-25 04:35:44 +00:00
[SV 58656] Fix mtime for large files on MS-Windows
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>.
This commit is contained in:
parent
1ae90c030d
commit
012918bf11
1 changed files with 15 additions and 0 deletions
15
src/remake.c
15
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;
|
||||
|
|
Loading…
Reference in a new issue