aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-11-18 09:37:42 +0100
committerFredrik Gustafsson <[email protected]>2013-11-18 09:37:42 +0100
commitb2e4599affa6718bba60ef3846d130513e9a740d (patch)
tree116115e2a365d204eb7b1ffc706ad8a9c69bf3fa /erts/emulator/sys/win32
parentf07816ab2826d2a4082442f1d8ca71b7bfb89a47 (diff)
parent22c39699f35142063f69c45bdb919bcba468fede (diff)
downloadotp-b2e4599affa6718bba60ef3846d130513e9a740d.tar.gz
otp-b2e4599affa6718bba60ef3846d130513e9a740d.tar.bz2
otp-b2e4599affa6718bba60ef3846d130513e9a740d.zip
Merge branch 'mhssler/add-os-unsetenv/OTP-11446' into maint
* mhssler/add-os-unsetenv/OTP-11446: erts: remove ?line macro in testcases Update primary bootstrap Add os:unsetenv/1
Diffstat (limited to 'erts/emulator/sys/win32')
-rw-r--r--erts/emulator/sys/win32/sys_env.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/erts/emulator/sys/win32/sys_env.c b/erts/emulator/sys/win32/sys_env.c
index 754f4c6e4c..9f977ad6c8 100644
--- a/erts/emulator/sys/win32/sys_env.c
+++ b/erts/emulator/sys/win32/sys_env.c
@@ -141,6 +141,24 @@ void fini_getenv_state(GETENV_STATE *state)
erts_smp_rwmtx_runlock(&environ_rwmtx);
}
+int erts_sys_unsetenv(char *key)
+{
+ int res = 0;
+ WCHAR *wkey = (WCHAR *) key;
+
+ SetLastError(0);
+ erts_smp_rwmtx_rlock(&environ_rwmtx);
+ GetEnvironmentVariableW(wkey,
+ NULL,
+ 0);
+ if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
+ res = (SetEnvironmentVariableW(wkey,
+ NULL) ? 0 : 1);
+ }
+ erts_smp_rwmtx_runlock(&environ_rwmtx);
+ return res;
+}
+
char*
win_build_environment(char* new_env)
{