Browse Source

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>
maint
Erik Faye-Lund 13 years ago committed by Junio C Hamano
parent
commit
6ac1b2a3b8
  1. 2
      compat/setenv.c

2
compat/setenv.c

@ -6,7 +6,7 @@ int gitsetenv(const char *name, const char *value, int replace) @@ -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;
}

Loading…
Cancel
Save