aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordatadiode <datadiode@users.noreply.github.com>2024-10-15 18:16:19 +0200
committerBrent Cook <busterb@gmail.com>2025-04-12 15:58:17 -0500
commitec123956230a44603196fd68725e03a9ecf36df3 (patch)
tree051c9f3b676a5657648c1f26411652bc5c1f5171
parent2c5e2c60d92a0741b6035e3dbc7d9ec6cee7ac9f (diff)
downloadportable-ec123956230a44603196fd68725e03a9ecf36df3.tar.gz
portable-ec123956230a44603196fd68725e03a9ecf36df3.tar.bz2
portable-ec123956230a44603196fd68725e03a9ecf36df3.zip
Don't break std* file descriptors (inspired by the other is_socket() which lives in poll_win.c)
-rw-r--r--crypto/compat/posix_win.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c
index 3e7d227..9409af5 100644
--- a/crypto/compat/posix_win.c
+++ b/crypto/compat/posix_win.c
@@ -163,6 +163,9 @@ wsa_errno(int err)
163static int 163static int
164is_socket(int fd) 164is_socket(int fd)
165{ 165{
166 /* Border case: Don't break std* file descriptors */
167 if (fd < 3)
168 return 0;
166 return (fd & 1) == 0; /* daringly assumes that any valid socket is even */ 169 return (fd & 1) == 0; /* daringly assumes that any valid socket is even */
167} 170}
168 171