aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/stdlib.c')
-rw-r--r--src/stdlib/stdlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stdlib/stdlib.c b/src/stdlib/stdlib.c
index 21547efe..8ec9e90b 100644
--- a/src/stdlib/stdlib.c
+++ b/src/stdlib/stdlib.c
@@ -219,7 +219,10 @@ OptionalText_t getenv_text(Text_t name) {
}
public
-void setenv_text(Text_t name, Text_t value) { setenv(Text$as_c_string(name), Text$as_c_string(value), 1); }
+void setenv_text(Text_t name, OptionalText_t value) {
+ if (value.tag == TEXT_NONE) unsetenv(Text$as_c_string(name));
+ else setenv(Text$as_c_string(name), Text$as_c_string(value), 1);
+}
typedef struct cleanup_s {
Closure_t cleanup_fn;