diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-12-23 22:57:40 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-12-23 22:57:40 +0000 |
commit | 1998ed587dbca1ad60d673c006b611e355a841f5 (patch) | |
tree | b505819f93d0ca924661233f69e3bcdf80f63ee2 /cpp/src/IcePack/ActivatorI.cpp | |
parent | minor fix (diff) | |
download | ice-1998ed587dbca1ad60d673c006b611e355a841f5.tar.bz2 ice-1998ed587dbca1ad60d673c006b611e355a841f5.tar.xz ice-1998ed587dbca1ad60d673c006b611e355a841f5.zip |
bug fix for environment vars
Diffstat (limited to 'cpp/src/IcePack/ActivatorI.cpp')
-rw-r--r-- | cpp/src/IcePack/ActivatorI.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp index dc876564109..3b93d46e769 100644 --- a/cpp/src/IcePack/ActivatorI.cpp +++ b/cpp/src/IcePack/ActivatorI.cpp @@ -293,28 +293,37 @@ IcePack::ActivatorI::activate(const ServerPtr& server) // const char* env = NULL; string envbuf; -//cout << "Activator: description.envs.size() = " << server->description.envs.size() << endl; if(!server->description.envs.empty()) { -//cout << "Activator: creating environment block" << endl; map<string, string> envMap; LPVOID parentEnv = GetEnvironmentStrings(); const char* var = reinterpret_cast<const char*>(parentEnv); + if(*var == '=') + { + // + // The environment block may start with some information about the + // current drive and working directory. This is indicated by a leading + // '=' character, so we skip to the first '\0' byte. + // + while(*var) + var++; + var++; + } while(*var) { string s(var); -//cout << " - adding parent variable `" << s << "'" << endl; string::size_type pos = s.find('='); if(pos != string::npos) { envMap.insert(map<string, string>::value_type(s.substr(0, pos), s.substr(pos + 1))); } + var += s.size(); + var++; // Skip the '\0' byte } FreeEnvironmentStrings(static_cast<char*>(parentEnv)); for(p = server->description.envs.begin(); p != server->description.envs.end(); ++p) { string s = *p; -//cout << " - adding descriptor variable `" << s << "'" << endl; string::size_type pos = s.find('='); if(pos != string::npos) { @@ -330,7 +339,6 @@ IcePack::ActivatorI::activate(const ServerPtr& server) } envbuf.push_back('\0'); env = envbuf.c_str(); -//cout << " - envbuf.size() = " << envbuf.size() << endl; } STARTUPINFO si; |