Skip to content

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

Merged
smorimoto merged 1 commit into
ocsigen:masterfrom
MisterDA:windows-dup-dup2-is-blocking-fix
Nov 7, 2021
Merged

smorimoto merged 1 commit into
ocsigen:masterfrom
MisterDA:windows-dup-dup2-is-blocking-fix

Conversation

@MisterDA

@MisterDA MisterDA commented Jun 18, 2021 •

Copy link
Copy Markdown
Contributor

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
Comment thread src/unix/lwt_unix.cppo.ml Resolved
@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
Copy Markdown
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 <[email protected]>
@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
Copy Markdown
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.

3 participants