diff options
| author | Theo Buehler <tb@openbsd.org> | 2026-08-13 07:06:03 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2026-08-13 07:06:03 +0200 |
| commit | cf07b889ef1c848e797be89c8d17f5f5a9f44557 (patch) | |
| tree | 4cde608d3d73bd95285eaddda12e9ada9dca46ea | |
| parent | 19455c1957470c627bf25db7efeca8f80651fdf3 (diff) | |
| parent | ebdedf67ea07b3e4193d446179970b74764eab0b (diff) | |
| download | portable-cf07b889ef1c848e797be89c8d17f5f5a9f44557.tar.gz portable-cf07b889ef1c848e797be89c8d17f5f5a9f44557.tar.bz2 portable-cf07b889ef1c848e797be89c8d17f5f5a9f44557.zip | |
Land #1358 - fix setting cloexec in socketpair shim
| -rw-r--r-- | tests/compat/pipe2.c | 7 |
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 | } |
