Skip to content

Commit

Permalink
fix(concord-once): building on Cygwin
Browse files Browse the repository at this point in the history
This fix is totally based off Anotra's PR commits #172, adapted to work on dev before the PR is merged.
  • Loading branch information
ThePedroo committed May 6, 2024
1 parent c226e7b commit 558f156
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/concord-once.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 558f156

Please sign in to comment.