diff options
author | Erlang/OTP <[email protected]> | 2010-05-04 08:50:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-05-04 08:50:40 +0000 |
commit | 33e2df7148957f2be1cb12f0302ac80034b8ad22 (patch) | |
tree | b784eeed4e376d440f4ad53fa21ff02c4525a58b | |
parent | 06ed4aab7ec48399a55323f0f605ba96db6d407f (diff) | |
parent | 6f40c6686d5e94aa2cead2739f61a45c594a7d6a (diff) | |
download | otp-33e2df7148957f2be1cb12f0302ac80034b8ad22.tar.gz otp-33e2df7148957f2be1cb12f0302ac80034b8ad22.tar.bz2 otp-33e2df7148957f2be1cb12f0302ac80034b8ad22.zip |
Merge branch 'sv/env-with-equal-sign' into dev
* sv/env-with-equal-sign:
allow open_port to set env vars containing a trailing '=' character
OTP-8614 sv/env-with-equal-sign
The erlang:open_port spawn and spawn_executable directives can include an
{env,Env} directive to set up environment variables for the spawned
process. A bug prevented applications from using {env,Env} to set an
environment variable whose value ended with a '=' (equal sign) character;
the trailing equal sign was mistaken as an indication that an environment
variable was to be cleared from the environment of the spawned process.
(Thanks to Steve Vinoski.)
-rw-r--r-- | erts/emulator/sys/unix/sys.c | 3 | ||||
-rw-r--r-- | erts/emulator/test/port_SUITE.erl | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 267f7d07aa..50b208848f 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -1325,7 +1325,8 @@ static char **build_unix_environment(char *block) } for (j = 0; j < i; j++) { - if (cpp[j][strlen(cpp[j])-1] == '=') { + size_t last = strlen(cpp[j])-1; + if (cpp[j][last] == '=' && strchr(cpp[j], '=') == cpp[j]+last) { cpp[j] = cpp[--len]; } } diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl index b9100738e4..eb69bf917b 100644 --- a/erts/emulator/test/port_SUITE.erl +++ b/erts/emulator/test/port_SUITE.erl @@ -881,6 +881,7 @@ env2(Config) -> ?line env_slave(Temp, [{"must_define_something","some_value"}, {"certainly_not_existing",false}, + {"ends_with_equal", "value="}, {Long,false}, {"glurf","a glorfy string"}]), |