X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FDaemon%2FDaemon.cc;h=8cbf98fbbfb6d72fdb0e0b597ae83bcd3ee7adea;hb=b76d83f9671e935cbd5f2c6873efae1f75d25dac;hp=6bd84ae4c785d4f434d998ce11b91198ac00fc22;hpb=d600f990c9e9ec8ef059e2c2e6b9b05b31d50a08;p=senf.git diff --git a/Utils/Daemon/Daemon.cc b/Utils/Daemon/Daemon.cc index 6bd84ae..8cbf98f 100644 --- a/Utils/Daemon/Daemon.cc +++ b/Utils/Daemon/Daemon.cc @@ -132,8 +132,11 @@ prefix_ void senf::Daemon::openLog() << " Could not open \"" << stdoutLog_ << "\" for redirecting stdout."; stdout_ = fd; } - if (stderrLog_ == stdoutLog_) - stderr_ = fd; + if (stderrLog_ == stdoutLog_) { + stderr_ = ::dup(fd); + if (stderr_ < 0) + SENF_THROW_SYSTEM_EXCEPTION("::dup()"); + } else if (! stderrLog_.empty()) { fd = ::open(stdoutLog_.c_str(), O_WRONLY | O_APPEND | O_CREAT, 0666); if (fd < 0) @@ -307,6 +310,7 @@ senf::Daemon * senf::Daemon::instance_ (0); prefix_ void senf::Daemon::configure() { + // int i (not unsigned) since argc_ is int ... for (int i (1); i