mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Make open(2) a macro that it replaces "/dev/null" by "nul" on MinGW.
This commit is contained in:
@@ -397,6 +397,10 @@ static inline int git_unlink(const char *pathname) {
|
||||
}
|
||||
#define unlink git_unlink
|
||||
|
||||
#define open(P, F, M...) \
|
||||
(__builtin_constant_p(*(P)) && !strcmp(P, "/dev/null") ? \
|
||||
open("nul", F, ## M) : open(P, F, ## M))
|
||||
|
||||
#include <time.h>
|
||||
struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||
|
||||
@@ -10,11 +10,7 @@ int run_command_v_opt(const char **argv, int flags)
|
||||
int fd_o[2] = { -1, -1 };
|
||||
|
||||
if (flags & RUN_COMMAND_NO_STDIN) {
|
||||
#ifndef __MINGW32__
|
||||
fd_i[0] = open("/dev/null", O_RDWR);
|
||||
#else
|
||||
fd_i[0] = open("nul", O_RDWR);
|
||||
#endif
|
||||
}
|
||||
if (flags & RUN_COMMAND_STDOUT_TO_STDERR)
|
||||
fd_o[1] = dup(2);
|
||||
|
||||
Reference in New Issue
Block a user