diff options
| author | datadiode <datadiode@users.noreply.github.com> | 2024-10-15 18:16:19 +0200 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2025-04-12 15:58:17 -0500 |
| commit | ec123956230a44603196fd68725e03a9ecf36df3 (patch) | |
| tree | 051c9f3b676a5657648c1f26411652bc5c1f5171 | |
| parent | 2c5e2c60d92a0741b6035e3dbc7d9ec6cee7ac9f (diff) | |
| download | portable-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.c | 3 |
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) | |||
| 163 | static int | 163 | static int |
| 164 | is_socket(int fd) | 164 | is_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 | ||
