diff options
author | Christian Pointner <equinox@anytun.org> | 2009-10-04 18:18:32 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-10-04 18:18:32 +0000 |
commit | b33b8131fd85fe7cf54934500e421d96efcd801b (patch) | |
tree | 1794b9fc72c6003549d095337a8812dfa9533382 /src/sysExec.cpp | |
parent | logtargets valgrind cleanup (diff) |
cleaned new exec script function
Diffstat (limited to 'src/sysExec.cpp')
-rw-r--r-- | src/sysExec.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/sysExec.cpp b/src/sysExec.cpp index ca62dfd..104581e 100644 --- a/src/sysExec.cpp +++ b/src/sysExec.cpp @@ -107,19 +107,14 @@ void anytun_exec(std::string const& script, StringVector const& args, StringList argv[args.size() + 1] = NULL; char** evp; - if(env.size()) { - evp = new char*[env.size() + 1]; - unsigned int i = 0; - for(StringList::const_iterator it = env.begin(); it != env.end(); ++it) { - evp[i] = new char[it->size() + 1]; - std::strcpy(evp[i], it->c_str()); - ++i; - } - evp[env.size()] = NULL; - } else { - evp = new char*[1]; - evp[0] = NULL; + evp = new char*[env.size() + 1]; + unsigned int i = 0; + for(StringList::const_iterator it = env.begin(); it != env.end(); ++it) { + evp[i] = new char[it->size() + 1]; + std::strcpy(evp[i], it->c_str()); + ++i; } + evp[env.size()] = NULL; execve(script.c_str(), argv, evp); // if execve returns, an error occurred, but logging doesn't work |