Argument of a call to assert() should never have side effects.
}
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) {