+2011-02-05 Eric Blake <eblake@redhat.com>
+
+ strerror_r-posix: port to cygwin
+ * lib/strerror_r.c (strerror_r) [__CYGWIN__]: Add cygwin
+ implementation.
+ * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Adjust comment.
+ * tests/test-strerror_r.c (main): Fix test.
+ * doc/posix-functions/strerror_r.texi (strerror_r): Document the
+ issue.
+
2011-02-05 Bruno Haible <bruno@clisp.org>
New module 'wmemchr'.
This function is missing on some platforms:
NetBSD 3.0, HP-UX 11.23, IRIX 6.5, Solaris 9, mingw.
@item
-glibc has an incompatible version of this function. The POSIX compliant code
+glibc and Cygwin have an incompatible version of this function. The
+POSIX compliant code
@smallexample
char *s = (strerror_r (err, buf, buflen) == 0 ? buf : NULL);
@end smallexample
#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 <limits.h>
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
if test $ac_cv_func_strerror_r = yes; then
if test -z "$ERRNO_H"; then
dnl The POSIX prototype is: int strerror_r (int, char *, size_t);
- dnl glibc's prototype: char *strerror_r (int, char *, size_t);
+ dnl glibc, Cygwin: char *strerror_r (int, char *, size_t);
dnl AIX 5.1, OSF/1 5.1: int strerror_r (int, char *, int);
AC_CACHE_CHECK([for strerror_r with POSIX signature],
[gl_cv_func_strerror_r_posix_signature],
if (ret == 0)
{
/* Truncated result. POSIX allows this, and it actually
- happens on AIX 6.1. */
- ASSERT (strcmp (buf, "BADFACE") != 0);
+ happens on AIX 6.1 and Cygwin. */
+ ASSERT ((strcmp (buf, "BADFACE") == 0) == (i == 0));
}
else
{