diff --git a/src/concord-once.c b/src/concord-once.c index f9621c11..a74ea9e7 100644 --- a/src/concord-once.c +++ b/src/concord-once.c @@ -72,12 +72,16 @@ ccord_global_init() } for (int i = 0; i < 2; i++) { const int on = 1; - if (0 != ioctl(shutdown_fds[i], FIOCLEX, NULL)) { - fputs("Failed to make shutdown pipe close on execute\n", - stderr); - goto fail_pipe_init; - } - if (0 != ioctl(shutdown_fds[i], FIONBIO, &on)) { + + #ifdef FIOCLEX + if (0 != ioctl(shutdown_fds[i], FIOCLEX, NULL)) { + fputs("Failed to make shutdown pipe close on execute\n", + stderr); + goto fail_pipe_init; + } + #endif + + if (0 != ioctl(shutdown_fds[i], (int)FIONBIO, &on)) { fputs("Failed to make shutdown pipe nonblocking\n", stderr); goto fail_pipe_init; } @@ -125,9 +129,17 @@ discord_dup_shutdown_fd(void) if (-1 == shutdown_fds[0]) return -1; if (-1 != (fd = dup(shutdown_fds[0]))) { const int on = 1; - if (0 != ioctl(fd, FIOCLEX, NULL) && 0 != ioctl(fd, FIONBIO, &on)) { + + #ifdef FIOCLEX + if (0 != ioctl(fd, FIOCLEX, NULL)) { + close(fd); + return -1; + } + #endif + + if (0 != ioctl(fd, (int)FIONBIO, &on)) { close(fd); - fd = -1; + return -1; } } return fd;