Return EINVAL in setenv() if var is NULL or the empty string to match
glibc behavior.
This commit is contained in:
3
env.c
3
env.c
@@ -253,6 +253,9 @@ setenv(var, val, overwrite)
|
|||||||
const char *cp;
|
const char *cp;
|
||||||
size_t esize;
|
size_t esize;
|
||||||
|
|
||||||
|
if (!var || *var == '\0')
|
||||||
|
return(EINVAL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POSIX says a var name with '=' is an error but BSD
|
* POSIX says a var name with '=' is an error but BSD
|
||||||
* just ignores the '=' and anything after it.
|
* just ignores the '=' and anything after it.
|
||||||
|
Reference in New Issue
Block a user