diff options
author | Othmar Gsenger <otti@anytun.org> | 2010-01-11 01:55:34 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2010-01-11 01:55:34 +0000 |
commit | 190d7f1a3db4980eace56f17d30d3ce65bae44b2 (patch) | |
tree | 4194f1f02d81c9d530d9809889cb01bcf087040d | |
parent | fixed double close of pipefd (diff) |
fixed line indention
fixed signal controler init position
-rw-r--r-- | src/anytun.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp index 222adf6..e7afbd5 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -410,7 +410,7 @@ int main(int argc, char* argv[]) // daemonizing has to done before any thread gets started #ifndef NO_DAEMON #ifndef NO_PRIVDROP - PrivInfo privs(gOpt.getUsername(), gOpt.getGroupname()); + PrivInfo privs(gOpt.getUsername(), gOpt.getGroupname()); #endif if(gOpt.getDaemonize()) { daemonize(); @@ -431,28 +431,28 @@ int main(int argc, char* argv[]) postup_script = new SysExec(gOpt.getPostUpScript(), args); } #endif - // this has to be called before the first thread is started -#if !( defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) - gSignalController.init(); -#endif #ifndef NO_DAEMON - if(gOpt.getChrootDir() != "") { - try { - do_chroot(gOpt.getChrootDir()); - } - catch(const std::runtime_error& e) { - cLog.msg(Log::PRIO_WARNING) << "ignoring chroot error: " << e.what(); + if(gOpt.getChrootDir() != "") { + try { + do_chroot(gOpt.getChrootDir()); + } + catch(const std::runtime_error& e) { + cLog.msg(Log::PRIO_WARNING) << "ignoring chroot error: " << e.what(); + } } - } #ifndef NO_PRIVDROP - privs.drop(); + privs.drop(); +#endif #endif +#if !( defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) + // this has to be called before the first thread is started + gSignalController.init(); #endif gResolver.init(); #ifndef NO_EXEC - boost::thread(boost::bind(&TunDevice::waitForPostUpScript,&dev)); - if (postup_script) - boost::thread(boost::bind(&SysExec::waitForScript,postup_script)); + boost::thread(boost::bind(&TunDevice::waitForPostUpScript,&dev)); + if (postup_script) + boost::thread(boost::bind(&SysExec::waitForScript,postup_script)); #endif #ifndef NO_CRYPT #ifndef USE_SSL_CRYPTO |