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

unix,stream: fix getting the correct fd for a handle #6838

Merged
merged 1 commit into from
May 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
unix,stream: fix getting the correct fd for a handle
On OSX it's possible that the fd is replaced, so use the proper libuv
API to get the correct fd.

PR-URL: #6753
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
saghul committed May 19, 2016
commit 4fe1d6e75fe6daa19150038c7fdb2de0f91c10fa
2 changes: 1 addition & 1 deletion src/stream_wrap.cc
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ int StreamWrap::GetFD() {
int fd = -1;
#if !defined(_WIN32)
if (stream() != nullptr)
fd = stream()->io_watcher.fd;
uv_fileno(reinterpret_cast<uv_handle_t*>(stream()), &fd);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might as well remove the #if !defined(_WIN32) guard now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows that's a HANDLE*, and while it can be cast to an int because only 32 bits are used AFAIS, I wasn't sure if we wanted to expose that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Let's leave it like this, then.

return fd;
}