From dec90a25abf40f350f1e53bdc080614a17508fe9 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 14 Dec 2019 08:00:00 +0100 Subject: [PATCH] syslogd: Set pipe fd non-blocking in timer backend Signed-off-by: Joachim Nilsson --- src/timer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/timer.c b/src/timer.c index 06fffb1..2229025 100644 --- a/src/timer.c +++ b/src/timer.c @@ -29,6 +29,7 @@ */ #include +#include #include #include #include @@ -179,6 +180,12 @@ int timer_init(void) goto err; } + rc = fcntl(timer_fd[0], F_GETFL, 0); + if (rc != -1) { + if (fcntl(timer_fd[0], F_SETFL, rc | O_NONBLOCK) < 0) + warn("Failed setting pipe() descriptor non-blocking"); + } + rc = socket_register(timer_fd[0], NULL, timer_cb, NULL); if (rc < 0) { warn("socket_register()");