Skip to content

Commit a38989b

Browse files
committed
unsetenv(3) returns int, not void
This compatilibity implementation has been returning a wrong type, ever since 731043f (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 <[email protected]>
1 parent af6d1d6 commit a38989b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compat/unsetenv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "../git-compat-util.h"
22

3-
void gitunsetenv (const char *name)
3+
int gitunsetenv(const char *name)
44
{
55
#if !defined(__MINGW32__)
66
extern char **environ;
@@ -24,4 +24,6 @@ void gitunsetenv (const char *name)
2424
++dst;
2525
}
2626
environ[dst] = NULL;
27+
28+
return 0;
2729
}

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ char *gitmkdtemp(char *);
726726

727727
#ifdef NO_UNSETENV
728728
#define unsetenv gitunsetenv
729-
void gitunsetenv(const char *);
729+
int gitunsetenv(const char *);
730730
#endif
731731

732732
#ifdef NO_STRCASESTR

0 commit comments

Comments
 (0)