-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Make sure errno
is set when socket operations fail
#2405
Conversation
@jeffhostetler I did not test this, like, at all. Could I ask you...? You seemed to have a concrete scenario where this was an issue, maybe you can cherry-pick and see whether this PR would fix it? |
2139350
to
077656c
Compare
Sure. I'll look at it tomorrow as I'm testing what I'm working on now. I wasn't sure if we wanted this in GFW or initially send it upstream. |
Great, thanks!
I'd like to test it in Git for Windows for a while first, then send it upstream. |
@jeffhostetler ping? |
yeah. i got distracted.... sorry. |
Should we include bind() and listen() too ? |
https://github.com/jeffhostetler/git/tree/mingw-setsockopt I gave it a try on top of the stuff I'm currently working on and it seemed ok, I tweaked the WINSOCK_RETURN() macro a bit to make it easier to debug in GDB. |
How? |
See my branch. I didn't modify your branch. I left in the fprintf's where I was testing it interactively. |
Could you kindly point me to it? I lost track... |
Oy, I had to scroll back only 3 lines to see it. Sorry for the noise. |
077656c
to
879ba71
Compare
And @jeffhostetler could you have another look over the patch? |
879ba71
to
234baba
Compare
I just pushed another fixup to my branch and kicked off #2417 to let the CI tests run. |
The winsock2 library provides functions that work on different data types than file descriptors, therefore we wrap them. But that is not the only difference: they also do not set `errno` but expect the callers to enquire about errors via `WSAGetLastError()`. Let's translate that into appropriate `errno` values whenever the socket operations fail so that Git's code base does not have to change its expectations. This closes git-for-windows#2404 Helped-by: Jeff Hostetler <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
234baba
to
c11f75c
Compare
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Make sure `errno` is set when socket operations fail
Our
mingw_*()
function family that works with sockets failed to seterrno
, as noticed in #2404.