]> git.proxmox.com Git - wasi-libc.git/blobdiff - libc-top-half/musl/src/env/unsetenv.c
Lazy-initialize the environment variables. (#184)
[wasi-libc.git] / libc-top-half / musl / src / env / unsetenv.c
index b14c4c929b1f18033e68a480d4500856f33bdaa5..40f0eea6d8a75fd5881a9eedaee61dc01376687f 100644 (file)
@@ -13,6 +13,13 @@ int unsetenv(const char *name)
                errno = EINVAL;
                return -1;
        }
+#ifdef __wasilibc_unmodified_upstream // Lazy environment variable init.
+#else
+// This specialized header is included within the function body to arranges for
+// the environment variables to be lazily initialized. It redefined `__environ`,
+// so don't remove or reorder it with respect to other code.
+#include "wasi/libc-environ-compat.h"
+#endif
        if (__environ) {
                char **e = __environ, **eo = e;
                for (; *e; e++)