mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Save the result of errno (aka WSAGetLastError() for WinSock) as soon as possible, to prevent anything in SOCK_GetNodeAddress resetting the value to 0 while trying to print the message for the error itself!
This commit is contained in:
parent
ab38e6cebb
commit
3b39a25ade
1 changed files with 7 additions and 3 deletions
10
src/i_tcp.c
10
src/i_tcp.c
|
@ -781,9 +781,13 @@ static void SOCK_Send(void)
|
||||||
&clientaddress[doomcom->remotenode].any, d);
|
&clientaddress[doomcom->remotenode].any, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
|
if (c == ERRSOCKET)
|
||||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
{
|
||||||
SOCK_GetNodeAddress(doomcom->remotenode), errno, strerror(errno));
|
int e = errno; // save error code so it can't be modified later
|
||||||
|
if (e != ECONNREFUSED && e != EWOULDBLOCK)
|
||||||
|
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
||||||
|
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue