From 194c1dbb5a04e29937b87d477a16927fa2c3be62 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 29 Aug 2007 14:16:46 +0100 Subject: [PATCH] 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 --- compat/mingw.c | 9 +++++++++ git-compat-util.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index ca3ae4cb06..6632192690 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -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); +} + diff --git a/git-compat-util.h b/git-compat-util.h index ddafec997f..9e075b715c 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -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