Simplify, no need to reset signal disposition in handler

On modern systems, both *BSD and Linux using GLIBC/musl, the signal's
disposition is not reset to SIG_DFL on invocation of its handler.  On
Linux this is true because GLIBC/musl wraps signal() in sigaction()
with the same semantics as BSD.

A follow-up commit will refactor to use sigaction().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-23 14:41:42 +02:00
parent 3309fb2d50
commit be5ce0af30
2 changed files with 4 additions and 20 deletions

View File

@ -360,14 +360,12 @@ void doexit(int signo)
void restart(int signo)
{
signal(SIGCONT, restart);
change_state = 1;
caught_TSTP = 0;
}
void stop_logging(int signo)
{
signal(SIGTSTP, stop_logging);
change_state = 1;
caught_TSTP = 1;
}
@ -382,13 +380,8 @@ void reload_daemon(int signo)
change_state = 1;
reload_symbols = 1;
if (signo == SIGUSR2) {
if (signo == SIGUSR2)
++reload_symbols;
signal(SIGUSR2, reload_daemon);
} else
signal(SIGUSR1, reload_daemon);
return;
}
static void Terminate(void)

View File

@ -2297,20 +2297,13 @@ void wallmsg(struct filed *f, struct iovec *iov)
void reapchild(int signo)
{
int saved_errno = errno;
#ifdef linux
int saved_errno;
int status;
while (wait3(&status, WNOHANG, NULL) > 0)
saved_errno = errno;
while (waitpid(-1, &status, WNOHANG) > 0)
;
signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
#else
signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
wait(NULL);
#endif
errno = saved_errno;
}
@ -2415,7 +2408,6 @@ void domark(int signo)
DupesPending--;
}
}
(void)signal(SIGALRM, domark);
LastAlarm = MarkInterval - MarkSeq;
if (DupesPending && LastAlarm > TIMERINTVL)
@ -3095,7 +3087,6 @@ static void logit(char *fmt, ...)
void sighup_handler(int signo)
{
restart = 1;
signal(SIGHUP, sighup_handler);
}
/**