From d83412e9d4ff5a11eb128de5079c465a63709541 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 4 Feb 2010 21:32:45 +0000 Subject: some cleanup --- src/posix/sysExec.hpp | 14 +++++++------- src/sysExec.cpp | 12 ++++++------ src/sysExec.h | 2 +- src/win32/sysExec.hpp | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/posix/sysExec.hpp b/src/posix/sysExec.hpp index 359c1e4..48cd8f2 100644 --- a/src/posix/sysExec.hpp +++ b/src/posix/sysExec.hpp @@ -63,17 +63,17 @@ char** dupEnv(StringList const& env) return evp; } -void SysExec::doExec(std::string const& script, StringVector const& args, StringList const& env) +void SysExec::doExec(StringVector const& args, StringList const& env) { int pipefd[2]; if(pipe(pipefd) == -1) { - cLog.msg(Log::PRIO_ERROR) << "executing script '" << script << "' pipe() error: " << AnytunErrno(errno); + cLog.msg(Log::PRIO_ERROR) << "executing script '" << script_ << "' pipe() error: " << AnytunErrno(errno); return; } pid_ = fork(); if(pid_ == -1) { - cLog.msg(Log::PRIO_ERROR) << "executing script '" << script << "' fork() error: " << AnytunErrno(errno); + cLog.msg(Log::PRIO_ERROR) << "executing script '" << script_ << "' fork() error: " << AnytunErrno(errno); return; } @@ -99,8 +99,8 @@ void SysExec::doExec(std::string const& script, StringVector const& args, String } char** argv = new char*[args.size() + 2]; - argv[0] = new char[script.size() + 1]; - std::strcpy(argv[0], script.c_str()); + argv[0] = new char[script_.size() + 1]; + std::strcpy(argv[0], script_.c_str()); for(unsigned int i=0; i= static_cast(sizeof(err))) { - cLog.msg(Log::PRIO_NOTICE) << "script '" << script_ << "' exec() error: " << AnytunErrno(err); + cLog.msg(Log::PRIO_ERROR) << "script '" << script_ << "' exec() error: " << AnytunErrno(err); close(pipefd_); return_code_ = -1; return return_code_; diff --git a/src/sysExec.cpp b/src/sysExec.cpp index 6e291d9..9fc6e10 100644 --- a/src/sysExec.cpp +++ b/src/sysExec.cpp @@ -38,32 +38,32 @@ #include "log.h" #include "anytunError.h" -//use system specific signal handler +//use system specific sys exec #ifndef _MSC_VER #include "sysExec.hpp" #else - #include "win32/sysExec.hpp" +#include "win32/sysExec.hpp" #endif SysExec::SysExec(std::string const& script) : script_(script),closed_(false),return_code_(0) { - doExec(script, StringVector(), StringList()); + doExec(StringVector(), StringList()); } SysExec::SysExec(std::string const& script, StringVector const& args) : script_(script),closed_(false),return_code_(0) { - doExec(script, args, StringList()); + doExec(args, StringList()); } SysExec::SysExec(std::string const& script, StringList const& env) : script_(script),closed_(false),return_code_(0) { - doExec( script, StringVector(), env); + doExec(StringVector(), env); } SysExec::SysExec(std::string const& script, StringVector const& args, StringList const& env) : script_(script),closed_(false),return_code_(0) { - doExec( script, args, env); + doExec(args, env); } int SysExec::getReturnCode() const diff --git a/src/sysExec.h b/src/sysExec.h index 02ac00e..6d0724e 100644 --- a/src/sysExec.h +++ b/src/sysExec.h @@ -57,7 +57,7 @@ class SysExec static void waitAndDestroy(SysExec*& s); private: - void doExec(std::string const& script, StringVector const& args, StringList const& env); + void doExec(StringVector const& args, StringList const& env); std::string script_; bool closed_; diff --git a/src/win32/sysExec.hpp b/src/win32/sysExec.hpp index d04ed40..eba26f4 100644 --- a/src/win32/sysExec.hpp +++ b/src/win32/sysExec.hpp @@ -67,13 +67,13 @@ bool endsWith(std::string const& string, std::string const& suffix) { return string.find(suffix, string.size() - suffix.size()) != std::string::npos; } -void SysExec::doExec(std::string const& script, StringVector const& args, StringList const& env) +void SysExec::doExec(StringVector const& args, StringList const& env) { std::vector arguments; bool isBatchFile = false; for(int i = 0; i < BATCH_FILE_EXTS_COUNT; ++i) { - if(endsWith(script, BATCH_FILE_EXTS[i])) { + if(endsWith(script_, BATCH_FILE_EXTS[i])) { isBatchFile = true; break; } @@ -84,7 +84,7 @@ void SysExec::doExec(std::string const& script, StringVector const& args, String arguments.insert(arguments.end(), BATCH_INTERPRETER.begin(), BATCH_INTERPRETER.end()); } arguments.push_back('\"'); - arguments.insert(arguments.end(), script.begin(), script.end()); + arguments.insert(arguments.end(), script_.begin(), script_.end()); arguments.push_back('\"'); arguments.push_back(' '); @@ -126,7 +126,7 @@ void SysExec::doExec(std::string const& script, StringVector const& args, String &process_info_ )) { - cLog.msg(Log::PRIO_ERROR) << "executing script '" << script << "' CreateProcess() error: " << GetLastError(); + cLog.msg(Log::PRIO_ERROR) << "executing script '" << script_ << "' CreateProcess() error: " << GetLastError(); return; } } -- cgit v1.2.3