Skip to content

Commit fa93bb2

Browse files
sschuberthgitster
authored andcommitted
MinGW: Fix stat definitions to work with MinGW runtime version 4.0
For an overview of changes in mingwrt-4.0 see: http://sourceforge.net/p/mingw/mingw-org-wsl/ci/4.0.0/tree/NEWS Signed-off-by: Sebastian Schuberth <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a2374f5 commit fa93bb2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

compat/mingw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ int mingw_stat(const char *file_name, struct stat *buf)
491491
return do_stat_internal(1, file_name, buf);
492492
}
493493

494-
#undef fstat
495494
int mingw_fstat(int fd, struct stat *buf)
496495
{
497496
HANDLE fh = (HANDLE)_get_osfhandle(fd);

compat/mingw.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,20 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
271271
#define lseek _lseeki64
272272

273273
/* use struct stat with 64 bit st_size */
274+
#ifdef stat
275+
#undef stat
276+
#endif
274277
#define stat _stati64
275278
int mingw_lstat(const char *file_name, struct stat *buf);
276279
int mingw_stat(const char *file_name, struct stat *buf);
277280
int mingw_fstat(int fd, struct stat *buf);
281+
#ifdef fstat
282+
#undef fstat
283+
#endif
278284
#define fstat mingw_fstat
285+
#ifdef lstat
286+
#undef lstat
287+
#endif
279288
#define lstat mingw_lstat
280289

281290
#ifndef _stati64

config.mak.uname

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
500500
NO_INET_NTOP = YesPlease
501501
NO_POSIX_GOODIES = UnfortunatelyYes
502502
DEFAULT_HELP_FORMAT = html
503-
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
503+
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
504504
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
505505
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
506506
compat/win32/pthread.o compat/win32/syslog.o \

0 commit comments

Comments
 (0)