aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/compat/pipe2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/compat/pipe2.c b/tests/compat/pipe2.c
index c0189db..3e79575 100644
--- a/tests/compat/pipe2.c
+++ b/tests/compat/pipe2.c
@@ -18,9 +18,10 @@ static int setfd(int fd, int flag)
18{ 18{
19 int rc = -1; 19 int rc = -1;
20 if (flag & FD_CLOEXEC) { 20 if (flag & FD_CLOEXEC) {
21 HANDLE h = (HANDLE)_get_osfhandle(fd); 21 /* fd is a Winsock SOCKET, not a CRT descriptor: use it as a
22 if (h != NULL) 22 * handle directly rather than translating with _get_osfhandle. */
23 rc = SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0) == 0 ? -1 : 0; 23 HANDLE h = (HANDLE)(LONG_PTR)fd;
24 rc = SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0) == 0 ? -1 : 0;
24 } 25 }
25 return rc; 26 return rc;
26} 27}