Repository navigation
Use is_blocking in dup and dup2 to fix ENOTSOCK on Windows - #869
Merged
smorimoto merged 1 commit intoNov 7, 2021
Merged
Conversation
MisterDA
force-pushed
the
windows-dup-dup2-is-blocking-fix
branch
from
October 12, 2021 17:09
49e8feb to
aa5e033
Compare
Contributor
Author
|
Changed the approach, I think it is much simpler now. |
is_blocking in dup and dup2 to fix ENOTSOCK on Windows
MisterDA
marked this pull request as ready for review
October 12, 2021 17:11
smorimoto
approved these changes
Oct 14, 2021
On Windows, calling Unix.clear_non_block and Unix.set_non_block is only supported on socket file descriptors. The function is_blocking already deals with the corner cases, but the current implementations of dup and dup2 don't make use of it. Thus, when then dup or dup2 wrappers are called with file socket descriptors, ENOTSOCK errors are raised. The fix is to reuse is_blocking in the wrappers. Signed-off-by: Antonin Décimo <[email protected]>
smorimoto
force-pushed
the
windows-dup-dup2-is-blocking-fix
branch
from
November 7, 2021 07:04
aa5e033 to
564363c
Compare
Member
|
Looks good now! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, calling
Unix.clear_non_blockandUnix.set_non_blockisonly supported on socket file descriptors. The function
is_blockingalready deals with the corner cases, but the current implementations
of
dupanddup2don't make use of it. Thus, when thedupordup2wrappers are called with file descriptors,
ENOTSOCKerrors areraised. The fix is to reuse
is_blockingin the wrappers.