diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-04-04 21:59:29 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-04-04 21:59:29 +0000 |
commit | 3661f3624acc46590d5504fda4f8714255fb2c8e (patch) | |
tree | e2cd17e19718d3f46944979a23e4c93dcf92584b /lib/server/Daemon.cpp | |
parent | 2f8d0c29536cdb306b525b78638727da4ead0022 (diff) |
Tailorization
Import of the upstream sources from
Repository: http://localhost:8000/
Kind: hg
Revision: 7807b7768163f1c2537756abe5416063989cebb1
Original author: tailor@rocio.int.aidworld.org
Date: 2008-03-16 19:44:36+00:00
Diffstat (limited to 'lib/server/Daemon.cpp')
-rw-r--r-- | lib/server/Daemon.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp index 292a628c..95f5c338 100644 --- a/lib/server/Daemon.cpp +++ b/lib/server/Daemon.cpp @@ -465,7 +465,8 @@ int Daemon::Main(const std::string &rConfigFileName) // Set new session if(::setsid() == -1) { - BOX_LOG_SYS_ERROR("Failed to setsid()"); + BOX_ERROR("Failed to setsid(): " << + strerror(errno)); THROW_EXCEPTION(ServerException, DaemoniseFailed) } @@ -474,7 +475,6 @@ int Daemon::Main(const std::string &rConfigFileName) { case -1: // error - BOX_LOG_SYS_ERROR("Failed to fork() a child"); THROW_EXCEPTION(ServerException, DaemoniseFailed) break; @@ -497,11 +497,9 @@ int Daemon::Main(const std::string &rConfigFileName) struct sigaction sa; sa.sa_handler = SignalHandler; sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); // macro - if(::sigaction(SIGHUP, &sa, NULL) != 0 || - ::sigaction(SIGTERM, &sa, NULL) != 0) + sigemptyset(&sa.sa_mask); // macro + if(::sigaction(SIGHUP, &sa, NULL) != 0 || ::sigaction(SIGTERM, &sa, NULL) != 0) { - BOX_LOG_SYS_ERROR("Failed to set signal handlers"); THROW_EXCEPTION(ServerException, DaemoniseFailed) } #endif // !WIN32 @@ -517,8 +515,7 @@ int Daemon::Main(const std::string &rConfigFileName) if(::write(pidFile, pid, pidsize) != pidsize) { - BOX_LOG_SYS_FATAL("Failed to write PID file: " << - pidFileName); + BOX_FATAL("can't write pid file"); THROW_EXCEPTION(ServerException, DaemoniseFailed) } @@ -547,7 +544,6 @@ int Daemon::Main(const std::string &rConfigFileName) int devnull = ::open(PLATFORM_DEV_NULL, O_RDWR, 0); if(devnull == -1) { - BOX_LOG_SYS_ERROR("Failed to open /dev/null"); THROW_EXCEPTION(CommonException, OSFileError); } // Then duplicate them to all three handles @@ -894,8 +890,6 @@ box_time_t Daemon::GetConfigFileModifiedTime() const { return 0; } - BOX_LOG_SYS_ERROR("Failed to stat configuration file: " << - GetConfigFileName()); THROW_EXCEPTION(CommonException, OSFileError) } |