diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bsd/tunDevice.cpp | 13 | ||||
-rw-r--r-- | src/linux/tunDevice.cpp | 13 | ||||
-rw-r--r-- | src/sysexec.hpp | 4 |
3 files changed, 25 insertions, 5 deletions
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp index 3bbba35..3ef62af 100644 --- a/src/bsd/tunDevice.cpp +++ b/src/bsd/tunDevice.cpp @@ -246,5 +246,16 @@ void TunDevice::do_ifconfig() #endif } - system(command.str().c_str()); + int result = system(command.str().c_str()); + if(result == -1) + cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig failed" << LogErrno(errno); + else { + if(WIFEXITED(result)) + cLog.msg(Log::PRIO_NOTICE) << "ifconfig returned " << WEXITSTATUS(result); + else if(WIFSIGNALED(result)) + cLog.msg(Log::PRIO_NOTICE) << "ifconfig terminated after signal " << WTERMSIG(result); + else + cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig: unkown error"; + } + } diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp index dba22e5..403cd99 100644 --- a/src/linux/tunDevice.cpp +++ b/src/linux/tunDevice.cpp @@ -168,7 +168,14 @@ void TunDevice::do_ifconfig() int result = system(command.str().c_str()); if(result == -1) - cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig failed"; - else - cLog.msg(Log::PRIO_NOTICE) << "ifconfig returned " << WEXITSTATUS(result); + cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig failed: " << LogErrno(errno); + else { + if(WIFEXITED(result)) + cLog.msg(Log::PRIO_NOTICE) << "ifconfig returned " << WEXITSTATUS(result); + else if(WIFSIGNALED(result)) + cLog.msg(Log::PRIO_NOTICE) << "ifconfig terminated after signal " << WTERMSIG(result); + else + cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig: unkown error"; + } + } diff --git a/src/sysexec.hpp b/src/sysexec.hpp index 2883102..0730cea 100644 --- a/src/sysexec.hpp +++ b/src/sysexec.hpp @@ -60,8 +60,10 @@ int execScript(std::string const& script, std::string const& ifname, std::string waitpid(pid, &status, 0); if(WIFEXITED(status)) cLog.msg(Log::PRIO_NOTICE) << "script '" << script << "' returned " << WEXITSTATUS(status); - if(WIFSIGNALED(status)) + else if(WIFSIGNALED(status)) cLog.msg(Log::PRIO_NOTICE) << "script '" << script << "' terminated after signal " << WTERMSIG(status); + else + cLog.msg(Log::PRIO_ERR) << "executing script: unkown error"; return status; } |