diff options
author | Elliott Hughes <enh@google.com> | 2014-04-22 17:41:00 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-04-22 17:41:00 -0700 |
commit | 58d9e280d459225aa8dc4533e883182b08215f7d (patch) | |
tree | 2c2771dfb1bf95012d13688f8f9142652ba0f9f8 /libc/bionic | |
parent | 635edbdf93a127da7db77d9cd174615734b4fb85 (diff) | |
download | bionic-58d9e280d459225aa8dc4533e883182b08215f7d.zip bionic-58d9e280d459225aa8dc4533e883182b08215f7d.tar.gz bionic-58d9e280d459225aa8dc4533e883182b08215f7d.tar.bz2 |
Switch to the upstream OpenBSD getenv/putenv/setenv implementation.
This fixes all the bugs found by the new tests.
Change-Id: Id5a5f9f39a0620208bafa053f871a044725b4795
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/clearenv.cpp (renamed from libc/bionic/clearenv.c) | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libc/bionic/clearenv.c b/libc/bionic/clearenv.cpp index 0f6f066..c70cc3e 100644 --- a/libc/bionic/clearenv.c +++ b/libc/bionic/clearenv.cpp @@ -26,17 +26,15 @@ * SUCH DAMAGE. */ -#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> -extern char** environ; - -int clearenv(void) -{ - char **P = environ; - - if (P != NULL) { - for (; *P; ++P) - *P = NULL; +int clearenv() { + char** e = environ; + if (e != NULL) { + for (; *e; ++e) { + *e = NULL; } - return 0; + } + return 0; } |