summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorErik Faye-Lund <kusmabite@gmail.com>2011-12-14 15:07:09 +0100
committerJunio C Hamano <gitster@pobox.com>2011-12-14 19:31:03 -0800
commit6ac1b2a3b8bd970e9fc175c42927f00d4d465bbf (patch)
treec833eace46cc906bf659f7f765ff410b0a24fb66 /compat
parent57590c72b4d3b02e32732c7d79514c0281d6c2b5 (diff)
downloadgit-6ac1b2a3b8bd970e9fc175c42927f00d4d465bbf.tar.gz
compat/setenv.c: error if name contains '='ef/setenv-putenv
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>
Diffstat (limited to 'compat')
-rw-r--r--compat/setenv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/setenv.c b/compat/setenv.c
index 89947b7134..fc1439a643 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -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;
}