mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
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:
parent
57590c72b4
commit
6ac1b2a3b8
|
@ -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…
Reference in a new issue