aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2026-07-20 10:44:33 +0200
committerTheo Buehler <tb@openbsd.org>2026-07-20 10:44:33 +0200
commit2ebaff40de470a53dc0c2658b219535824104401 (patch)
tree62d3925e4585d3366b586bb39993770a94388ff2
parent7464eb4e649a1f3362bbe5127d103becdda5d399 (diff)
parent8d13180cabb91022244310425144c168b0ac2ba9 (diff)
downloadportable-2ebaff40de470a53dc0c2658b219535824104401.tar.gz
portable-2ebaff40de470a53dc0c2658b219535824104401.tar.bz2
portable-2ebaff40de470a53dc0c2658b219535824104401.zip
Land 1331 - user crt _open/_close in win32 socketpair sentinel test
-rw-r--r--tests/compat/pipe2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/compat/pipe2.c b/tests/compat/pipe2.c
index d7b4062..9d93a55 100644
--- a/tests/compat/pipe2.c
+++ b/tests/compat/pipe2.c
@@ -38,16 +38,20 @@ static int setfl(int fd, int flag)
38/* 38/*
39 * Have open() temporarily use up file descriptors until reaching beyond the 39 * Have open() temporarily use up file descriptors until reaching beyond the
40 * allocated sockets, then leak the ones conflicting with any of the latter. 40 * allocated sockets, then leak the ones conflicting with any of the latter.
41 *
42 * open()/close() are redefined to posix_open()/posix_close() in this file,
43 * which tag descriptors with the 0x80000000 bit. Use the raw CRT _open/_close
44 * so the values compare against the socket handles in the same namespace.
41 */ 45 */
42static void create_issue_1069_sentinels(int socket_vector[2]) 46static void create_issue_1069_sentinels(int socket_vector[2])
43{ 47{
44 int fd = open("CONIN$", O_RDONLY); 48 int fd = _open("CONIN$", O_RDONLY);
45 if (fd == -1 || (fd > socket_vector[0] && fd > socket_vector[1])) { 49 if (fd == -1 || (fd > socket_vector[0] && fd > socket_vector[1])) {
46 return; 50 return;
47 } 51 }
48 create_issue_1069_sentinels(socket_vector); 52 create_issue_1069_sentinels(socket_vector);
49 if (fd != socket_vector[0] && fd != socket_vector[1]) { 53 if (fd != socket_vector[0] && fd != socket_vector[1]) {
50 close(fd); 54 _close(fd);
51 } 55 }
52} 56}
53 57