Fix errno references when handling socket errors.
When using socket functions, "sockerrno" is supposed to be used to retrieve the error code as opposed to "errno", so that it is translated to the correct call on Windows (WSAGetLastError() - Windows does not update errno on socket errors). Unfortunately, the use of sockerrno is inconsistent throughout the tinc codebase, as errno is often used incorrectly on socket-related calls. This commit fixes these oversights, which improves socket error handling on Windows.
This commit is contained in:
parent
058473dc8d
commit
0c026f3c6d
11 changed files with 35 additions and 34 deletions
|
|
@ -465,7 +465,7 @@ int main_loop(void) {
|
|||
#endif
|
||||
|
||||
if(!event_loop()) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Error while waiting for input: %s", strerror(errno));
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Error while waiting for input: %s", sockstrerror(sockerrno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue