Skip to content

Commit

Permalink
compat/setenv.c: error if name contains '='
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kusma authored and gitster committed Dec 15, 2011
1 parent 57590c7 commit 6ac1b2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/setenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int gitsetenv(const char *name, const char *value, int replace)
size_t namelen, valuelen;
char *envstr;

if (!name || !value) {
if (!name || strchr(name, '=') || !value) {
errno = EINVAL;
return -1;
}
Expand Down

0 comments on commit 6ac1b2a

Please sign in to comment.