Permalink
Browse files

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 <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
1 parent 57590c7 commit 6ac1b2a3b8bd970e9fc175c42927f00d4d465bbf @kusma kusma committed with gitster Dec 14, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 compat/setenv.c
View
@@ -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;
}

0 comments on commit 6ac1b2a

Please sign in to comment.