From: Guus Sliepen Date: Wed, 30 Oct 2019 17:19:31 +0000 (+0100) Subject: Fix signal pipe creation when compiling with -DNDEBUG. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=0f19bd98e1a95ab45d0ed46d79a07502b65a4c95;p=meshlink Fix signal pipe creation when compiling with -DNDEBUG. Argument of a call to assert() should never have side effects. --- 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) {