diff options
Diffstat (limited to 'compat')
-rw-r--r-- | compat/mingw.c | 16 | ||||
-rw-r--r-- | compat/mingw.h | 6 | ||||
-rw-r--r-- | compat/win32/pthread.c | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index ab65f77ab9..c5bfb39b39 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -140,6 +140,22 @@ int mingw_open (const char *filename, int oflags, ...) return fd; } +#undef fopen +FILE *mingw_fopen (const char *filename, const char *otype) +{ + if (!strcmp(filename, "/dev/null")) + filename = "nul"; + return fopen(filename, otype); +} + +#undef freopen +FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream) +{ + if (filename && !strcmp(filename, "/dev/null")) + filename = "nul"; + return freopen(filename, otype, stream); +} + /* * The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC. * Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch. diff --git a/compat/mingw.h b/compat/mingw.h index e254fb4e06..e81e752ed2 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -170,6 +170,12 @@ int link(const char *oldpath, const char *newpath); int mingw_open (const char *filename, int oflags, ...); #define open mingw_open +FILE *mingw_fopen (const char *filename, const char *otype); +#define fopen mingw_fopen + +FILE *mingw_freopen (const char *filename, const char *otype, FILE *stream); +#define freopen mingw_freopen + char *mingw_getcwd(char *pointer, int len); #define getcwd mingw_getcwd diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c index 5fc1670bee..0f949fc425 100644 --- a/compat/win32/pthread.c +++ b/compat/win32/pthread.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Andrzej K. Haczewski <ahaczewski@gmail.com> * - * DISCLAMER: The implementation is Git-specific, it is subset of original + * DISCLAIMER: The implementation is Git-specific, it is subset of original * Pthreads API, without lots of other features that Git doesn't use. * Git also makes sure that the passed arguments are valid, so there's * no need for double-checking. |