From 30f7b2c519dd4a5746c8c3ebf9bbd24dced2d8e2 Mon Sep 17 00:00:00 2001 From: codemastr Date: Tue, 1 Jun 2004 21:28:54 +0000 Subject: [PATCH] Made the win32 socket error reporting also handle regular system errors --- Changes | 2 ++ src/support.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index b35e417cc..8df46658f 100644 --- a/Changes +++ b/Changes @@ -3228,3 +3228,5 @@ This is the 3.2 fixes branch. LinDevel - Added /dns c to clear the DNS cache (#0001852) suggested by samson. - Seems I forgot to del_Command() SPAMFILTER and TEMPSHUN. +- Made the win32 socket error reporting also handle regular system errors (#0001851) + reported by Troco diff --git a/src/support.c b/src/support.c index 9f08e057b..9c1b70424 100644 --- a/src/support.c +++ b/src/support.c @@ -2330,6 +2330,7 @@ struct u_WSA_errors WSAErrors[] = { char *sock_strerror(int error) { + static char unkerr[64]; int start = 0; int stop = sizeof(WSAErrors)/sizeof(WSAErrors[0])-1; int mid; @@ -2337,6 +2338,9 @@ char *sock_strerror(int error) if (!error) /* strerror compatibility */ return NULL; + if (error < WSABASEERR) /* Just a regular error code */ + return strerror(error); + /* Microsoft decided not to use sequential numbers for the error codes, * so we can't just use the array index for the code. But, at least * use a binary search to make it as fast as possible. @@ -2352,6 +2356,7 @@ char *sock_strerror(int error) else return WSAErrors[mid].error_string; } - return NULL; + sprintf(unkerr, "Unknown Error: %d", error); + return unkerr; } #endif