mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
util: handle or ignore SIGPIPE signal
In chronyc handle SIGPIPE similarly to SIGTERM. In chronyd ignore the signal to avoid crashing when a TCP socket will be needed (e.g. for NTS-KE) and will be unexpectedly closed from the other side.
This commit is contained in:
8
util.c
8
util.c
@@ -996,7 +996,7 @@ UTI_FdSetCloexec(int fd)
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
UTI_SetQuitSignalsHandler(void (*handler)(int))
|
||||
UTI_SetQuitSignalsHandler(void (*handler)(int), int ignore_sigpipe)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
@@ -1021,6 +1021,12 @@ UTI_SetQuitSignalsHandler(void (*handler)(int))
|
||||
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
||||
LOG_FATAL("sigaction(%d) failed", SIGHUP);
|
||||
#endif
|
||||
|
||||
if (ignore_sigpipe)
|
||||
sa.sa_handler = SIG_IGN;
|
||||
|
||||
if (sigaction(SIGPIPE, &sa, NULL) < 0)
|
||||
LOG_FATAL("sigaction(%d) failed", SIGPIPE);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user