Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use is_blocking in dup and dup2 to fix ENOTSOCK on Windows #869

Merged

Conversation

MisterDA
Copy link
Contributor

@MisterDA MisterDA commented Jun 18, 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 the dup or dup2
wrappers are called with file descriptors, ENOTSOCK errors are
raised. The fix is to reuse is_blocking in the wrappers.

@MisterDA MisterDA mentioned this pull request Jul 1, 2021
1 task
@MisterDA MisterDA force-pushed the windows-dup-dup2-is-blocking-fix branch from 49e8feb to aa5e033 Compare October 12, 2021 17:09
@MisterDA
Copy link
Contributor Author

Changed the approach, I think it is much simpler now.

@MisterDA MisterDA changed the title Reuse set_blocking in dup and dup2 Use is_blocking in dup and dup2 to fix ENOTSOCK on Windows Oct 12, 2021
@MisterDA MisterDA marked this pull request as ready for review October 12, 2021 17:11
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 <antonin@tarides.com>
@smorimoto smorimoto force-pushed the windows-dup-dup2-is-blocking-fix branch from aa5e033 to 564363c Compare November 7, 2021 07:04
@smorimoto
Copy link
Member

Looks good now!

@smorimoto smorimoto merged commit ad0f982 into ocsigen:master Nov 7, 2021
@MisterDA MisterDA deleted the windows-dup-dup2-is-blocking-fix branch November 7, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants