Provide git_exit() for MinGW

Apparently, MinGW's exit function has problems with negative
exit codes.  Substitute them by 1.

This fixes at least t1300, which failed because the exit code of
git-config with an invalid file was 0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2007-08-29 14:16:46 +01:00
parent dd56555ea5
commit 194c1dbb5a
2 changed files with 12 additions and 0 deletions

View File

@@ -322,3 +322,12 @@ int mingw_socket(int domain, int type, int protocol)
}
return s;
}
#undef exit
int git_exit(int code)
{
if (code < 0)
exit(1);
exit(code);
}

View File

@@ -472,6 +472,9 @@ int mingw_socket(int domain, int type, int protocol);
extern void quote_argv(const char **dst, const char **src);
extern const char *parse_interpreter(const char *cmd);
extern __attribute__((noreturn)) int git_exit(int code);
#define exit git_exit
#endif /* __MINGW32__ */
#endif