Skip to content

Commit 6ac1b2a

Browse files
kusmagitster
authored andcommitted
compat/setenv.c: error if name contains '='
According to POSIX, setenv should error out with EINVAL if it's asked to set an environment variable whose name contains an equals sign. Implement this detail in our compatibility-fallback. Signed-off-by: Erik Faye-Lund <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 57590c7 commit 6ac1b2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/setenv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int gitsetenv(const char *name, const char *value, int replace)
66
size_t namelen, valuelen;
77
char *envstr;
88

9-
if (!name || !value) {
9+
if (!name || strchr(name, '=') || !value) {
1010
errno = EINVAL;
1111
return -1;
1212
}

0 commit comments

Comments
 (0)