aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix/sys.c
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/unix/sys.c
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/unix/sys.c')
-rw-r--r--erts/emulator/sys/unix/sys.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 151fa06e8e..737ffd9f94 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -1328,10 +1328,18 @@ static char **build_unix_environment(char *block)
}
}
- for (j = 0; j < i; j++) {
+ for (j = 0; j < i; ) {
size_t last = strlen(cpp[j])-1;
if (cpp[j][last] == '=' && strchr(cpp[j], '=') == cpp[j]+last) {
cpp[j] = cpp[--len];
+ if (len < i) {
+ i--;
+ } else {
+ j++;
+ }
+ }
+ else {
+ j++;
}
}