aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-06-11 09:32:02 +0000
committerErlang/OTP <[email protected]>2010-06-11 09:32:02 +0000
commitf58c3fd91edb99ab04f57828c932fb3cc4dd46d7 (patch)
treeedfc3dbdd9abd4d0efc03cd04855db551df35655 /erts/emulator/sys/win32
parentc0f23851df50d6215981805102754b590c05acec (diff)
parent65ccc309a0225863913d991f56f17e2aa4f85266 (diff)
downloadotp-f58c3fd91edb99ab04f57828c932fb3cc4dd46d7.tar.gz
otp-f58c3fd91edb99ab04f57828c932fb3cc4dd46d7.tar.bz2
otp-f58c3fd91edb99ab04f57828c932fb3cc4dd46d7.zip
Merge branch 'se/port_SUITE_env' into dev
* se/port_SUITE_env: fix open_port with many unset env vars allow open_port with env vars with trailing '=' on Windows OTP-8701 se/port_SUITE_env open_port/2 with the spawn and spawn_executable options can include an {env,Env} option. In some cases unsetting variables would not work on Unix (typically if more variables were unset than were actually present in the environment).
Diffstat (limited to 'erts/emulator/sys/win32')
-rw-r--r--erts/emulator/sys/win32/sys_env.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/erts/emulator/sys/win32/sys_env.c b/erts/emulator/sys/win32/sys_env.c
index ac4be3f316..02c8433a10 100644
--- a/erts/emulator/sys/win32/sys_env.c
+++ b/erts/emulator/sys/win32/sys_env.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2002-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2002-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -145,15 +145,17 @@ merge_environment(char *old, char *add)
for(j = 0; a_arg[j] != NULL; ++j){
char **tmp;
char *current = a_arg[j];
+ char *eq_p = strchr(current,'=');
+ int unset = (eq_p!=NULL && eq_p[1]=='\0');
if ((tmp = find_arg(c_arg, current)) != NULL) {
- if (current[strlen(current)-1] != '=') {
+ if (!unset) {
*tmp = current;
} else {
*tmp = c_arg[--i];
c_arg[i] = NULL;
}
- } else if (current[strlen(current)-1] != '=') {
+ } else if (!unset) {
c_arg[i++] = current;
c_arg[i] = NULL;
}