event/SignalMonitor: throw exception instead of raising fatal error

This commit is contained in:
Max Kellermann 2017-08-11 09:36:22 +02:00
parent e8333316ee
commit 6d43e70a93

View File

@ -24,7 +24,7 @@
#include "SocketMonitor.hxx" #include "SocketMonitor.hxx"
#include "util/Manual.hxx" #include "util/Manual.hxx"
#include "system/FatalError.hxx" #include "system/Error.hxx"
#ifdef USE_SIGNALFD #ifdef USE_SIGNALFD
#include "system/SignalFD.hxx" #include "system/SignalFD.hxx"
@ -141,7 +141,7 @@ static void
x_sigaction(int signum, const struct sigaction &act) x_sigaction(int signum, const struct sigaction &act)
{ {
if (sigaction(signum, &act, nullptr) < 0) if (sigaction(signum, &act, nullptr) < 0)
FatalSystemError("sigaction() failed"); throw MakeErrno("sigaction() failed");
} }
#endif #endif
@ -184,7 +184,7 @@ SignalMonitorRegister(int signo, SignalHandler handler)
sigaddset(&signal_mask, signo); sigaddset(&signal_mask, signo);
if (sigprocmask(SIG_BLOCK, &signal_mask, nullptr) < 0) if (sigprocmask(SIG_BLOCK, &signal_mask, nullptr) < 0)
FatalSystemError("sigprocmask() failed"); throw MakeErrno("sigprocmask() failed");
monitor->Update(signal_mask); monitor->Update(signal_mask);
#else #else