unsetenv(3) returns int, not void

This compatilibity implementation has been returning a wrong type, ever since 731043fd (Add compat/unsetenv.c ., 2006-01-25) added to the system, yet nobody noticed it in the past 16 years, presumably because no code checks failures in their unsetenv() calls. Sigh. For now, make it always succeed. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Oct 29, 2021 at 14:42 UTC a38989bd5bc850900667ae1b3c0cd43797b066f0
2 files changed +4 -2
compat/unsetenv.c
+3 -1
@@ -1,6 +1,6 @@
1 #include "../git-compat-util.h"
2
3 -void gitunsetenv (const char *name)
3 +int gitunsetenv(const char *name)
4 {
5 #if !defined(__MINGW32__)
6 extern char **environ;
@@ -24,4 +24,6 @@ void gitunsetenv (const char *name)
24 ++dst;
25 }
26 environ[dst] = NULL;
27 +
28 + return 0;
29 }
git-compat-util.h
+1 -1
@@ -726,7 +726,7 @@ char *gitmkdtemp(char *);
726
727 #ifdef NO_UNSETENV
728 #define unsetenv gitunsetenv
729 -void gitunsetenv(const char *);
729 +int gitunsetenv(const char *);
730 #endif
731
732 #ifdef NO_STRCASESTR