curl-library
Re: cvs: curl /lib strerror.c
Date: Tue, 6 Apr 2004 14:00:23 +0200
> Log:
> remove the general use of sys_nerr
This patch does the wrong thing for Windows. I'll explain;
error-text for errors in range 0 - (sys_nerr-1) comes from
strerror() as usual.
Winsock and core API errors (FormatMessage) are *mostly* above
this range. Those that overlap could come from a core Windows function.
But since libcurl uses mostly std-ansi functions, that chance is
rather slim.
--- CVS-latest/lib/strerror.c Tue Apr 06 08:06:10 2004
+++ lib/strerror.c Tue Apr 06 13:32:31 2004
@@ -510,7 +510,9 @@
#if defined(WIN32) && !defined(__CYGWIN__)
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
- if (err >= 0 && err < sys_nerr) {
+ if (err >= 0 && err < sys_nerr)
+ strncpy(buf, strerror(err), max);
+ else {
if (!get_winsock_error (err, buf, max) &&
!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
LANG_NEUTRAL, buf, max, NULL))
--- --gvReceived on 2004-04-06