]> git.ipfire.org Git - thirdparty/git.git/commitdiff
unsetenv(3) returns int, not void
authorJunio C Hamano <gitster@pobox.com>
Fri, 29 Oct 2021 21:42:12 +0000 (14:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Oct 2021 22:00:58 +0000 (15:00 -0700)
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>
compat/unsetenv.c
git-compat-util.h

index bf5fd7063bc98964382b193cc9171a734c7aa790..b9d34af6136746358f496cb407fe195965388ba4 100644 (file)
@@ -1,6 +1,6 @@
 #include "../git-compat-util.h"
 
-void gitunsetenv (const char *name)
+int gitunsetenv(const char *name)
 {
 #if !defined(__MINGW32__)
      extern char **environ;
@@ -24,4 +24,6 @@ void gitunsetenv (const char *name)
          ++dst;
      }
      environ[dst] = NULL;
+
+     return 0;
 }
index b46605300abf818d27bc04f8d0a727bc6a272330..0f7e369a5d8ef2e88734746ef2098c82412894bf 100644 (file)
@@ -726,7 +726,7 @@ char *gitmkdtemp(char *);
 
 #ifdef NO_UNSETENV
 #define unsetenv gitunsetenv
-void gitunsetenv(const char *);
+int gitunsetenv(const char *);
 #endif
 
 #ifdef NO_STRCASESTR