SignalSet::add(const int sig) {
insert(sig);
struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
sa.sa_handler = internalHandler;
+ sigfillset(&sa.sa_mask);
if (sigaction(sig, &sa, 0) < 0) {
erase(sig);
isc_throw(SignalSetError, "failed to register a signal handler for"
// Unregister only if we own this signal.
if (local_signals_.find(sig) != local_signals_.end()) {
struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL;
+ sigfillset(&sa.sa_mask);
if (sigaction(sig, &sa, 0) < 0) {
isc_throw(SignalSetError, "unable to restore original signal"
" handler for signal: " << sig);
/// Check that the signals are recorded by the signal handlers.
TEST_F(SignalSetTest, twoSignals) {
// Register handlers for two signals.
- signal_set_.reset(new SignalSet(SIGHUP, SIGINT));
+ ASSERT_NO_THROW(signal_set_.reset(new SignalSet(SIGHUP, SIGINT)));
// Send SIGHUP signal to the process.
ASSERT_EQ(0, raise(SIGHUP));
// The SIGHUP should be the next one in the queue to be handled.