X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrerror_r.c;h=1fa52d99da600dbf43e19cd46c23f9230296ef4f;hb=46380c372f75d7a8609c6646e48099a9b84f7ec2;hp=0cc02889b1a3d0c4d3213640881d2883e218aa3d;hpb=d60f3b0c6b0f93a601acd1cfd3923f94ca05abb0;p=gnulib.git diff --git a/lib/strerror_r.c b/lib/strerror_r.c index 0cc02889b..1fa52d99d 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -27,7 +27,7 @@ #if HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__) && !EXTEND_STRERROR_R /* The system's strerror_r function is OK, except that its third argument - is 'int', not 'size_t'. */ + is 'int', not 'size_t', or its return type is wrong. */ # include @@ -61,6 +61,11 @@ strerror_r (int errnum, char *buf, size_t buflen) else ret = strerror_r (errnum, buf, buflen); } +# elif defined __CYGWIN__ + /* Cygwin only provides the glibc interface, is thread-safe, and + always succeeds (although it may truncate). */ + strerror_r (errnum, buf, buflen); + ret = 0; # else ret = strerror_r (errnum, buf, buflen); # endif @@ -98,7 +103,7 @@ strerror_r (int errnum, char *buf, size_t buflen) extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen); int ret = __xpg_strerror_r (errnum, buf, buflen); - return (ret < 0 ? errno : 0); + return (ret < 0 ? errno : ret); } #else /* (__GLIBC__ >= 2 || defined __UCLIBC__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) || EXTEND_STRERROR_R */