musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/env/clearenv.c 8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/env/clearenv.c b/src/env/clearenv.c
index 62d50952..da187752 100644
--- a/src/env/clearenv.c
+++ b/src/env/clearenv.c
@@ -1,10 +1,14 @@
#define _GNU_SOURCE
#include <stdlib.h>
+#include "libc.h"
-extern char **__environ;
+static void dummy(char *old, char *new) {}
+weak_alias(dummy, __env_rm_add);
int clearenv()
{
- __environ[0] = 0;
+ char **e = __environ;
+ __environ = 0;
+ if (e) while (*e) __env_rm_add(*e++, 0);
return 0;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月28日 02:45:45 +0000

AltStyle によって変換されたページ (->オリジナル) /