syslogd: Set pipe fd non-blocking in timer backend

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-12-14 08:00:00 +01:00
parent 2179d5a862
commit dec90a25ab

View File

@ -29,6 +29,7 @@
*/
#include <err.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <time.h>
@ -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()");