--------------------- PatchSet 4952 Date: 2002/09/12 18:33:25 Author: serassio Branch: nt-2_5 Tag: (none) Log: Fixed some problems on errors description Members: include/util.h:1.10.14.4->1.10.14.5 lib/win32lib.c:1.1.32.7->1.1.32.8 port/win32/include/squid-mswin.h:1.1.2.12->1.1.2.13 Index: squid/include/util.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/util.h,v retrieving revision 1.10.14.4 retrieving revision 1.10.14.5 diff -u -r1.10.14.4 -r1.10.14.5 --- squid/include/util.h 13 Apr 2002 14:58:55 -0000 1.10.14.4 +++ squid/include/util.h 12 Sep 2002 18:34:00 -0000 1.10.14.5 @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.10.14.4 2002/04/13 14:58:55 serassio Exp $ + * $Id: util.h,v 1.10.14.5 2002/09/12 18:34:00 serassio Exp $ * * AUTHOR: Harvest Derived * @@ -70,7 +70,6 @@ extern char *xstrdup(const char *); extern char *xstrndup(const char *, size_t); extern const char *xstrerror(void); -extern const char *xbstrerror(int); extern int tvSubMsec(struct timeval, struct timeval); extern int tvSubUsec(struct timeval, struct timeval); extern double tvSubDsec(struct timeval, struct timeval); @@ -154,6 +153,7 @@ extern gid_t getegid(void); extern int setgid(gid_t); extern int setegid(gid_t); +extern const char *WIN32_strerror(int); #endif #endif /* SQUID_UTIL_H */ Index: squid/lib/win32lib.c =================================================================== RCS file: /cvsroot/squid-sf//squid/lib/win32lib.c,v retrieving revision 1.1.32.7 retrieving revision 1.1.32.8 diff -u -r1.1.32.7 -r1.1.32.8 --- squid/lib/win32lib.c 13 Aug 2002 19:49:06 -0000 1.1.32.7 +++ squid/lib/win32lib.c 12 Sep 2002 18:33:25 -0000 1.1.32.8 @@ -1,5 +1,5 @@ /* - * $Id: win32lib.c,v 1.1.32.7 2002/08/13 19:49:06 serassio Exp $ + * $Id: win32lib.c,v 1.1.32.8 2002/09/12 18:33:25 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -35,12 +35,12 @@ */ #include "squid.h" -#undef strerror /* The following code section is part of an EXPERIMENTAL native */ /* Windows NT/2000 Squid port - Compiles only on MS Visual C++ */ #if defined(_SQUID_MSWIN_) +#undef strerror #define sys_nerr _sys_nerr #undef assert @@ -339,43 +339,63 @@ const char *errconst; const char *errdesc; } _wsaerrtext[] = { +WSA_E_CANCELLED,"WSA_E_CANCELLED","Lookup cancelled.", +WSA_E_NO_MORE,"WSA_E_NO_MORE","No more data available.", WSAEACCES,"WSAEACCES","Permission denied.", WSAEADDRINUSE,"WSAEADDRINUSE","Address already in use.", WSAEADDRNOTAVAIL,"WSAEADDRNOTAVAIL","Cannot assign requested address.", WSAEAFNOSUPPORT,"WSAEAFNOSUPPORT","Address family not supported by protocol family.", WSAEALREADY,"WSAEALREADY","Operation already in progress.", +WSAEBADF,"WSAEBADF","Bad file number.", +WSAECANCELLED,"WSAECANCELLED","Operation cancelled.", WSAECONNABORTED,"WSAECONNABORTED","Software caused connection abort.", WSAECONNREFUSED,"WSAECONNREFUSED","Connection refused.", WSAECONNRESET,"WSAECONNRESET","Connection reset by peer.", WSAEDESTADDRREQ,"WSAEDESTADDRREQ","Destination address required.", +WSAEDQUOT,"WSAEDQUOT","Disk quota exceeded.", WSAEFAULT,"WSAEFAULT","Bad address.", WSAEHOSTDOWN,"WSAEHOSTDOWN","Host is down.", WSAEHOSTUNREACH,"WSAEHOSTUNREACH","No route to host.", WSAEINPROGRESS,"WSAEINPROGRESS","Operation now in progress.", WSAEINTR,"WSAEINTR","Interrupted function call.", WSAEINVAL,"WSAEINVAL","Invalid argument.", +WSAEINVALIDPROCTABLE,"WSAEINVALIDPROCTABLE","Invalid procedure table from service provider.", +WSAEINVALIDPROVIDER,"WSAEINVALIDPROVIDER","Invalid service provider version number.", WSAEISCONN,"WSAEISCONN","Socket is already connected.", +WSAELOOP,"WSAELOOP","Too many levels of symbolic links.", WSAEMFILE,"WSAEMFILE","Too many open files.", WSAEMSGSIZE,"WSAEMSGSIZE","Message too long.", +WSAENAMETOOLONG,"WSAENAMETOOLONG","File name is too long.", WSAENETDOWN,"WSAENETDOWN","Network is down.", WSAENETRESET,"WSAENETRESET","Network dropped connection on reset.", WSAENETUNREACH,"WSAENETUNREACH","Network is unreachable.", WSAENOBUFS,"WSAENOBUFS","No buffer space available.", +WSAENOMORE,"WSAENOMORE","No more data available.", WSAENOPROTOOPT,"WSAENOPROTOOPT","Bad protocol option.", WSAENOTCONN,"WSAENOTCONN","Socket is not connected.", +WSAENOTEMPTY,"WSAENOTEMPTY","Directory is not empty.", WSAENOTSOCK,"WSAENOTSOCK","Socket operation on nonsocket.", WSAEOPNOTSUPP,"WSAEOPNOTSUPP","Operation not supported.", WSAEPFNOSUPPORT,"WSAEPFNOSUPPORT","Protocol family not supported.", WSAEPROCLIM,"WSAEPROCLIM","Too many processes.", WSAEPROTONOSUPPORT,"WSAEPROTONOSUPPORT","Protocol not supported.", WSAEPROTOTYPE,"WSAEPROTOTYPE","Protocol wrong type for socket.", +WSAEPROVIDERFAILEDINIT,"WSAEPROVIDERFAILEDINIT","Unable to initialise a service provider.", +WSAEREFUSED,"WSAEREFUSED","Refused.", +WSAEREMOTE,"WSAEREMOTE","Too many levels of remote in path.", WSAESHUTDOWN,"WSAESHUTDOWN","Cannot send after socket shutdown.", WSAESOCKTNOSUPPORT,"WSAESOCKTNOSUPPORT","Socket type not supported.", +WSAESTALE,"WSAESTALE","Stale NFS file handle.", WSAETIMEDOUT,"WSAETIMEDOUT","Connection timed out.", +WSAETOOMANYREFS,"WSAETOOMANYREFS","Too many references.", +WSAEUSERS,"WSAEUSERS","Too many users.", WSAEWOULDBLOCK,"WSAEWOULDBLOCK","Resource temporarily unavailable.", WSANOTINITIALISED,"WSANOTINITIALISED","Successful WSAStartup not yet performed.", -WSASYSNOTREADY,"WSASYSNOTREADY","Network subsystem is unavailable.", -WSAVERNOTSUPPORTED,"WSAVERNOTSUPPORTED","Winsock.dll version out of range.", +WSASERVICE_NOT_FOUND,"WSASERVICE_NOT_FOUND","Service not found.", +WSASYSCALLFAILURE,"WSASYSCALLFAILURE","System call failure.", +WSASYSNOTREADY,"WSASYSNOTREADY","Network subsystem is unavailable.", +WSATYPE_NOT_FOUND,"WSATYPE_NOT_FOUND","Class type not found.", +WSAVERNOTSUPPORTED,"WSAVERNOTSUPPORTED","Winsock.dll version out of range.", WSAEDISCON,"WSAEDISCON","Graceful shutdown in progress." }; @@ -397,9 +417,9 @@ break; } if (errind == -1) - snprintf(xwsaerror_buf, BUFSIZ, "(%d) Unknown", err); + snprintf(xwsaerror_buf, BUFSIZ, "Unknown"); else - snprintf(xwsaerror_buf, BUFSIZ, "(%d) %s, %s", err, _wsaerrtext[errind].errconst, _wsaerrtext[errind].errdesc); + snprintf(xwsaerror_buf, BUFSIZ, "%s, %s", _wsaerrtext[errind].errconst, _wsaerrtext[errind].errdesc); return xwsaerror_buf; } @@ -416,15 +436,17 @@ } /* - * xbstrerror with argument for late notification */ + * WIN32_strerror with argument for late notification */ const char * -xbstrerror(int err) +WIN32_strerror(int err) { static char xbstrerror_buf[BUFSIZ]; + if (err < 0 || err >= sys_nerr) - return ("Unknown"); - snprintf(xbstrerror_buf, BUFSIZ, "(%d) %s", err, strerror(err)); + strncpy(xbstrerror_buf, wsastrerror(err), BUFSIZ); + else + strncpy(xbstrerror_buf, strerror(err), BUFSIZ); return xbstrerror_buf; } Index: squid/port/win32/include/squid-mswin.h =================================================================== RCS file: /cvsroot/squid-sf//squid/port/win32/include/Attic/squid-mswin.h,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -r1.1.2.12 -r1.1.2.13 --- squid/port/win32/include/squid-mswin.h 12 Aug 2002 19:36:38 -0000 1.1.2.12 +++ squid/port/win32/include/squid-mswin.h 12 Sep 2002 18:35:59 -0000 1.1.2.13 @@ -1,5 +1,5 @@ /* - * $Id: squid-mswin.h,v 1.1.2.12 2002/08/12 19:36:38 serassio Exp $ + * $Id: squid-mswin.h,v 1.1.2.13 2002/09/12 18:35:59 serassio Exp $ * * AUTHOR: Guido Serassio & Andrey Shorin * @@ -222,7 +222,7 @@ extern __declspec(thread) int ws32_result; -#define strerror(e) xbstrerror(e) +#define strerror(e) WIN32_strerror(e) /* internal to CRTLIB */ /* used also in win32lib.c */