mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
so there are at least two different strerror_r() versions and our brand
new configure script detects them and now this code acts according to what API that was detected
This commit is contained in:
parent
f28389c87b
commit
189c2f4989
@ -506,10 +506,17 @@ 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
|
||||||
|
#ifdef HAVE_POSIX_STRERROR_R
|
||||||
strerror_r(err, buf, max);
|
strerror_r(err, buf, max);
|
||||||
/* this may set errno to ERANGE if insufficient storage was supplied via
|
/* this may set errno to ERANGE if insufficient storage was supplied via
|
||||||
strerrbuf and buflen to contain the generated message string, or EINVAL
|
strerrbuf and buflen to contain the generated message string, or EINVAL
|
||||||
if the value of errnum is not a valid error number.*/
|
if the value of errnum is not a valid error number.*/
|
||||||
|
#else
|
||||||
|
/* HAVE_GLIBC_STRERROR_R */
|
||||||
|
char buffer[256];
|
||||||
|
char *msg = strerror_r(err, buffer, sizeof(buffer));
|
||||||
|
strncpy(buf, msg, max);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
strncpy(buf, strerror(err), max);
|
strncpy(buf, strerror(err), max);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user