-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ssl: Handle that inet:getopts may return {ok, []} #7522
ssl: Handle that inet:getopts may return {ok, []} #7522
Conversation
CT Test Results 2 files 66 suites 51m 0s ⏱️ Results for commit 392771c. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
If the standard C library call getsockopt(2) returns an error for an option - then no return value is created for that option. There is not check about the socket's state in the call chain; if the inet_drv port is still open, then the getsockopt(2) call is executed. So it should be possible that inet:getsockopt(Port, [sndbuf]) (or recbuf), for a Port that is not dead yet but the underlying socket is closed, may return {ok,[]}. Closes erlang#7506
ed9bee2
to
392771c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was considering using just one clause with Opts ++ Acc
instead two with [Opt | Acc]
and Acc
, but the suggested change can be seen as an optimization (since it does not call '++'/2
) and safer since it will crash if we should get something unforeseeable from inet:getopts/2
...
@raimo It also visualizes that inet:getopts might return an empty list which I think is not completely obvious from the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
If the standard C library call getsockopt(2) returns an error for an option - then no return value is created for that option. There is not check about the socket's state in the call chain; if the inet_drv port is still open, then the getsockopt(2) call is executed.
So it should be possible that inet:getsockopt(Port, [sndbuf]) (or recbuf), for a Port that is not dead yet but the underlying socket is closed, may return {ok,[]}.
Closes 7506