X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=compat%2Fmingw.c;h=c5bfb39b3949430cd06093afdbc85ecc22f8c9c7;hb=796a01c41ca0b66f798571c7e876b3de4607f498;hp=ab65f77ab99500d99d24a9b7266669f37bb02cb2;hpb=a0075d9e6ae211e8bde3eb40c8cdebb1772ee680;p=git.git diff --git a/compat/mingw.c b/compat/mingw.c index ab65f77ab..c5bfb39b3 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.