Skip to content

Commit 296f510

Browse files
committed
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 b543717 commit 296f510

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
@@ -616,7 +616,6 @@ int mingw_stat(const char *file_name, struct stat *buf)
616616
return do_stat_internal(1, file_name, buf);
617617
}
618618

619-
#undef fstat
620619
int mingw_fstat(int fd, struct stat *buf)
621620
{
622621
HANDLE fh = (HANDLE)_get_osfhandle(fd);

compat/mingw.h

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

280280
/* use struct stat with 64 bit st_size */
281+
#ifdef stat
282+
#undef stat
283+
#endif
281284
#define stat _stati64
282285
int mingw_lstat(const char *file_name, struct stat *buf);
283286
int mingw_stat(const char *file_name, struct stat *buf);
284287
int mingw_fstat(int fd, struct stat *buf);
288+
#ifdef fstat
289+
#undef fstat
290+
#endif
285291
#define fstat mingw_fstat
292+
#ifdef lstat
293+
#undef lstat
294+
#endif
286295
#define lstat mingw_lstat
287296

288297
#ifndef _stati64

config.mak.uname

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

0 commit comments

Comments
 (0)