From 0f19bd98e1a95ab45d0ed46d79a07502b65a4c95 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 30 Oct 2019 18:19:31 +0100 Subject: [PATCH 1/1] Fix signal pipe creation when compiling with -DNDEBUG. Argument of a call to assert() should never have side effects. --- src/event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/event.c b/src/event.c index aed423ad..f72529ef 100644 --- a/src/event.c +++ b/src/event.c @@ -174,8 +174,12 @@ static void signalio_handler(event_loop_t *loop, void *data, int flags) { } static void pipe_init(event_loop_t *loop) { - assert(pipe(loop->pipefd) == 0); - io_add(loop, &loop->signalio, signalio_handler, NULL, loop->pipefd[0], IO_READ); + int result = pipe(loop->pipefd); + assert(result == 0); + + if(result == 0) { + io_add(loop, &loop->signalio, signalio_handler, NULL, loop->pipefd[0], IO_READ); + } } static void pipe_exit(event_loop_t *loop) { -- 2.39.5