From: Daniel Stenberg Date: Thu, 6 May 2004 10:49:40 +0000 (+0000) Subject: if no strerror_r prototype is found, we provide our own to prevent picky X-Git-Tag: curl-7_12_0~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f74820cfc2319ebd5b52ebfbe90a7ba612923c7;p=thirdparty%2Fcurl.git if no strerror_r prototype is found, we provide our own to prevent picky compilers to warn --- diff --git a/acinclude.m4 b/acinclude.m4 index 3bfb11246f..a582a4eec2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -396,6 +396,17 @@ AC_DEFUN([CURL_CHECK_STRERROR_R], AC_MSG_RESULT(no))])]) if test "x$strerror_r" = "xyes"; then + + dnl check if strerror_r is properly declared in the headers + AC_CHECK_DECL(strerror_r, , + AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto]) +, +[#include +#include +#include +#include +]) + dnl determine if this strerror_r() is glibc or POSIX AC_MSG_CHECKING([for a glibc strerror_r API]) AC_TRY_RUN([ diff --git a/lib/strerror.c b/lib/strerror.c index 6cc87091bc..d5c80d1a6d 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -32,6 +32,15 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +#ifdef HAVE_NO_STRERROR_R_DECL +#ifdef HAVE_POSIX_STRERROR_R +/* seen on AIX 5100-02 gcc 2.9 */ +extern int strerror_r(int errnum, char *strerrbuf, size_t buflen); +#else +extern char *strerror_r(int errnum, char *buf, size_t buflen); +#endif +#endif + const char * curl_easy_strerror(CURLcode error) {