Skip to content

Commit

Permalink
Don't break std* file descriptors (inspired by the other is_socket() …
Browse files Browse the repository at this point in the history
…which lives in poll_win.c)
  • Loading branch information
datadiode committed Oct 15, 2024
1 parent 55a2331 commit 7d69463
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/compat/posix_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ wsa_errno(int err)
static int
is_socket(int fd)
{
/* Border case: Don't break std* file descriptors */
if (fd < 3)
return 0;
return (fd & 1) == 0; /* daringly assumes that any valid socket is even */
}

Expand Down

0 comments on commit 7d69463

Please sign in to comment.