aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-25 12:45:01 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-25 12:45:01 +0000
commit189c2f498987e443836aada953ace7795202e350 (patch)
tree2fb716fa9ab2067c157b289b719512694b40988c /lib
parentf28389c87b02cabfed341a39c8ba78e816e272c3 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_strerror.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/curl_strerror.c b/lib/curl_strerror.c
index 0d4ecbef8..570759603 100644
--- a/lib/curl_strerror.c
+++ b/lib/curl_strerror.c
@@ -506,11 +506,18 @@ const char *Curl_strerror(struct connectdata *conn, int err)
if (err >= 0 && err < sys_nerr) {
/* These should be atomic and hopefully thread-safe */
#ifdef HAVE_STRERROR_R
+#ifdef HAVE_POSIX_STRERROR_R
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
+ /* HAVE_GLIBC_STRERROR_R */
+ char buffer[256];
+ char *msg = strerror_r(err, buffer, sizeof(buffer));
+ strncpy(buf, msg, max);
+#endif
+#else
strncpy(buf, strerror(err), max);
#endif
*(buf+max) = '\0';