diff options
author | Fredrik Gustafsson <[email protected]> | 2013-11-18 10:00:46 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-11-18 10:00:46 +0100 |
commit | 04f5e4e820f792b3f07dd232f582e6a7e0a3d3f7 (patch) | |
tree | 676a2c175d7b2e6fe993344409db35137d8186e5 /erts/emulator/sys | |
parent | 22b3a285aadffdb02f04230b78c167f52f7d7bc1 (diff) | |
parent | b2e4599affa6718bba60ef3846d130513e9a740d (diff) | |
download | otp-04f5e4e820f792b3f07dd232f582e6a7e0a3d3f7.tar.gz otp-04f5e4e820f792b3f07dd232f582e6a7e0a3d3f7.tar.bz2 otp-04f5e4e820f792b3f07dd232f582e6a7e0a3d3f7.zip |
Merge branch 'maint'
Conflicts:
bootstrap/lib/kernel/ebin/os.beam
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r-- | erts/emulator/sys/unix/sys.c | 10 | ||||
-rw-r--r-- | erts/emulator/sys/win32/sys_env.c | 18 |
2 files changed, 28 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) { 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)
{
|