Skip to content

Commit 558f156

Browse files
committed
fix(concord-once): building on Cygwin
This fix is totally based off Anotra's PR commits #172, adapted to work on dev before the PR is merged.
1 parent c226e7b commit 558f156

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/concord-once.c

+20-8
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ ccord_global_init()
7272
}
7373
for (int i = 0; i < 2; i++) {
7474
const int on = 1;
75-
if (0 != ioctl(shutdown_fds[i], FIOCLEX, NULL)) {
76-
fputs("Failed to make shutdown pipe close on execute\n",
77-
stderr);
78-
goto fail_pipe_init;
79-
}
80-
if (0 != ioctl(shutdown_fds[i], FIONBIO, &on)) {
75+
76+
#ifdef FIOCLEX
77+
if (0 != ioctl(shutdown_fds[i], FIOCLEX, NULL)) {
78+
fputs("Failed to make shutdown pipe close on execute\n",
79+
stderr);
80+
goto fail_pipe_init;
81+
}
82+
#endif
83+
84+
if (0 != ioctl(shutdown_fds[i], (int)FIONBIO, &on)) {
8185
fputs("Failed to make shutdown pipe nonblocking\n", stderr);
8286
goto fail_pipe_init;
8387
}
@@ -125,9 +129,17 @@ discord_dup_shutdown_fd(void)
125129
if (-1 == shutdown_fds[0]) return -1;
126130
if (-1 != (fd = dup(shutdown_fds[0]))) {
127131
const int on = 1;
128-
if (0 != ioctl(fd, FIOCLEX, NULL) && 0 != ioctl(fd, FIONBIO, &on)) {
132+
133+
#ifdef FIOCLEX
134+
if (0 != ioctl(fd, FIOCLEX, NULL)) {
135+
close(fd);
136+
return -1;
137+
}
138+
#endif
139+
140+
if (0 != ioctl(fd, (int)FIONBIO, &on)) {
129141
close(fd);
130-
fd = -1;
142+
return -1;
131143
}
132144
}
133145
return fd;

0 commit comments

Comments
 (0)