summaryrefslogtreecommitdiffstats
path: root/usr/klibc/clearenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/clearenv.c')
-rw-r--r--usr/klibc/clearenv.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr/klibc/clearenv.c b/usr/klibc/clearenv.c
new file mode 100644
index 0000000..7c2435e
--- /dev/null
+++ b/usr/klibc/clearenv.c
@@ -0,0 +1,17 @@
+/*
+ * clearenv.c
+ *
+ * Empty the environment
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include "env.h"
+
+/* Note: if environ has been malloc'd, it will be freed on the next
+ setenv() or putenv() */
+int clearenv(void)
+{
+ environ = (char **)__null_environ;
+ return 0;
+}