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:
Etienne Dechamps 2014-06-26 20:42:40 +01:00
parent 058473dc8d
commit 0c026f3c6d
11 changed files with 35 additions and 34 deletions

View file

@ -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;
}