1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-11 07:39:50 -04:00

Always include setup.h as the first header file.

Added a more verbose comment about what strerror_r() can set errno to in
case of failure.
This file still doesn't build on Solaris due to a missing 'sys_nerr' symbol.
This commit is contained in:
Daniel Stenberg 2004-03-25 07:33:11 +00:00
parent eab8cdc640
commit accc6eb91a

View File

@ -20,8 +20,9 @@
* *
***************************************************************************/ ***************************************************************************/
#include <curl/curl.h>
#include "setup.h" #include "setup.h"
#include <curl/curl.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -503,7 +504,10 @@ const char *Curl_strerror(struct connectdata *conn, int err)
if (err >= 0 && err < sys_nerr) { if (err >= 0 && err < sys_nerr) {
/* These should be atomic and hopefully thread-safe */ /* These should be atomic and hopefully thread-safe */
#ifdef HAVE_STRERROR_R #ifdef HAVE_STRERROR_R
strerror_r(err, buf, max); /* this may set ERANGE! */ strerror_r(err, buf, max);
/* this may set errno to ERANGE if insufficient storage was supplied via
strerrbuf and buflen to contain the generated message string, or EINVAL
if the value of errnum is not a valid error number.*/
#else #else
strncpy(buf, strerror(err), max); strncpy(buf, strerror(err), max);
#endif #endif