summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-11-29 15:41:48 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-11-29 15:41:48 -0800
commit0ae87432aa7bbc18664d4f68306e121a2db8a91d (patch)
tree24f772fdaca82e5a32d10ceab48f37a637c4e910
parentMerge branch 'jc/fix-ref-sorting-parse' (diff)
parentunsetenv(3) returns int, not void (diff)
downloadtgif-0ae87432aa7bbc18664d4f68306e121a2db8a91d.tar.xz
Merge branch 'jc/unsetenv-returns-an-int'
The compatibility implementation for unsetenv(3) were written to mimic ancient, non-POSIX, variant seen in an old glibc; it has been changed to return an integer to match the more modern era. * jc/unsetenv-returns-an-int: unsetenv(3) returns int, not void
-rw-r--r--compat/unsetenv.c4
-rw-r--r--git-compat-util.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index bf5fd7063b..b9d34af613 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -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;
}
diff --git a/git-compat-util.h b/git-compat-util.h
index d70ce14286..7176a43381 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -729,7 +729,7 @@ char *gitmkdtemp(char *);
#ifdef NO_UNSETENV
#define unsetenv gitunsetenv
-void gitunsetenv(const char *);
+int gitunsetenv(const char *);
#endif
#ifdef NO_STRCASESTR