From ec123956230a44603196fd68725e03a9ecf36df3 Mon Sep 17 00:00:00 2001 From: datadiode Date: Tue, 15 Oct 2024 18:16:19 +0200 Subject: Don't break std* file descriptors (inspired by the other is_socket() which lives in poll_win.c) --- crypto/compat/posix_win.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crypto/compat/posix_win.c') 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) 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 */ } -- cgit v1.2.3-55-g6feb