aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix
diff options
context:
space:
mode:
authorMartin Hässler <[email protected]>2013-11-09 21:04:06 +0100
committerMartin Hässler <[email protected]>2013-11-09 21:04:06 +0100
commit7b739330bb459401f9c11f0f84912aedc7ee22cd (patch)
treee1ffbca9adb63a1132c6c8af8236b725a8c5da56 /erts/emulator/sys/unix
parent768a64354e3d69b3c0840a84dd072601c67ca39d (diff)
downloadotp-7b739330bb459401f9c11f0f84912aedc7ee22cd.tar.gz
otp-7b739330bb459401f9c11f0f84912aedc7ee22cd.tar.bz2
otp-7b739330bb459401f9c11f0f84912aedc7ee22cd.zip
Add os:unsetenv/1
New BIF os:unsetenv/1 which deletes an environment variable and returns 'true'. Does not change any old functionality. Calls the libc function unsetenv(3) on UNIX and SetEnvironmentVariableW(key, NULL) on Windows. The unicode support is the same as for os:getenv and os:putenv.
Diffstat (limited to 'erts/emulator/sys/unix')
-rw-r--r--erts/emulator/sys/unix/sys.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 401b37b9d2..61f9f6a59a 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -2489,6 +2489,16 @@ erts_sys_getenv(char *key, char *value, size_t *size)
return res;
}
+int
+erts_sys_unsetenv(char *key)
+{
+ int res;
+ erts_smp_rwmtx_rwlock(&environ_rwmtx);
+ res = unsetenv(key);
+ erts_smp_rwmtx_rwunlock(&environ_rwmtx);
+ return res;
+}
+
void
sys_init_io(void)
{