Switch to the upstream OpenBSD getenv/putenv/setenv implementation.

This fixes all the bugs found by the new tests.

Change-Id: Id5a5f9f39a0620208bafa053f871a044725b4795
diff --git a/libc/bionic/clearenv.c b/libc/bionic/clearenv.cpp
similarity index 88%
rename from libc/bionic/clearenv.c
rename to 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;
 }