Properly restore errno if NET_FAILURE_RETRY fails.
If NET_FAILURE_RETRY fails, it throws an exception. In all but
one codepath, that exception ends up being passed back to Java
land immediately, so it doesn't matter what errno is set to.
However, in the case where we need to retry the socket call with
a sockaddr_in (i.e., NET_IPV4_FALLBACK), we clear the exception
and march on. This means that if errno is touched by
throwErrnoException (strace showed this happening, for example,
if futex() returns EAGAIN), we don't retry the socket call and
instead return the previous EAFNOSUPPORT error to the caller.
Also modify IO_FAILURE_RETRY for consistency.
2 files changed