Return EINVAL in setenv() if var is NULL or the empty string to match

glibc behavior.
This commit is contained in:
Todd C. Miller
2009-06-15 13:10:01 +00:00
parent 633357448a
commit 44ace77355

3
env.c
View File

@@ -253,6 +253,9 @@ setenv(var, val, overwrite)
const char *cp;
size_t esize;
if (!var || *var == '\0')
return(EINVAL);
/*
* POSIX says a var name with '=' is an error but BSD
* just ignores the '=' and anything after it.