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>
This commit is contained in:
Erik Faye-Lund 2011-12-14 15:07:09 +01:00 committed by Junio C Hamano
parent 57590c72b4
commit 6ac1b2a3b8

View file

@ -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;
}