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 <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Sebastian Schuberth 2013-09-11 18:02:09 +02:00 committed by Junio C Hamano
parent a2374f58e8
commit fa93bb20d7
3 changed files with 10 additions and 2 deletions

View File

@ -491,7 +491,6 @@ int mingw_stat(const char *file_name, struct stat *buf)
return do_stat_internal(1, file_name, buf); return do_stat_internal(1, file_name, buf);
} }
#undef fstat
int mingw_fstat(int fd, struct stat *buf) int mingw_fstat(int fd, struct stat *buf)
{ {
HANDLE fh = (HANDLE)_get_osfhandle(fd); HANDLE fh = (HANDLE)_get_osfhandle(fd);

View File

@ -271,11 +271,20 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
#define lseek _lseeki64 #define lseek _lseeki64
/* use struct stat with 64 bit st_size */ /* use struct stat with 64 bit st_size */
#ifdef stat
#undef stat
#endif
#define stat _stati64 #define stat _stati64
int mingw_lstat(const char *file_name, struct stat *buf); int mingw_lstat(const char *file_name, struct stat *buf);
int mingw_stat(const char *file_name, struct stat *buf); int mingw_stat(const char *file_name, struct stat *buf);
int mingw_fstat(int fd, struct stat *buf); int mingw_fstat(int fd, struct stat *buf);
#ifdef fstat
#undef fstat
#endif
#define fstat mingw_fstat #define fstat mingw_fstat
#ifdef lstat
#undef lstat
#endif
#define lstat mingw_lstat #define lstat mingw_lstat
#ifndef _stati64 #ifndef _stati64

View File

@ -500,7 +500,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_INET_NTOP = YesPlease NO_INET_NTOP = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html DEFAULT_HELP_FORMAT = html
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \ COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \ compat/win32/pthread.o compat/win32/syslog.o \