]> sourceware.org Git - newlib-cygwin.git/commitdiff
strerror: match recent glibc changes
authorEric Blake <eblake@redhat.com>
Mon, 23 May 2011 20:43:06 +0000 (20:43 +0000)
committerEric Blake <eblake@redhat.com>
Mon, 23 May 2011 20:43:06 +0000 (20:43 +0000)
* errno.cc (strerror): Print unknown errno as int.
(__xpg_strerror_r): Likewise, and don't clobber strerror buffer.

winsup/cygwin/ChangeLog
winsup/cygwin/errno.cc

index cb051bf6da9fa7d9b81105e70d8cada59418858b..35b7eea7e61960006ea003ffa62b5c7d4b9e968c 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-23  Eric Blake  <eblake@redhat.com>
+
+       * errno.cc (strerror): Print unknown errno as int.
+       (__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
+
 2011-05-23  Corinna Vinschen  <corinna@vinschen.de>
 
        * fhandler_process.cc (thread_info::fill_if_match): Reformat.
index e881fc64959378db81ebb78dc4667b9b1ca80a8a..aa311b7e2d6cb985dcf656a822119f6165a87b51 100644 (file)
@@ -382,8 +382,8 @@ strerror (int errnum)
   char *errstr = strerror_worker (errnum);
   if (!errstr)
     {
-      __small_sprintf (errstr = _my_tls.locals.strerror_buf, "Unknown error %u",
-                      (unsigned) errnum);
+      __small_sprintf (errstr = _my_tls.locals.strerror_buf, "Unknown error %d",
+                       errnum);
       errno = _impure_ptr->_errno = EINVAL;
     }
   return errstr;
@@ -409,10 +409,10 @@ __xpg_strerror_r (int errnum, char *buf, size_t n)
     return ERANGE;
   int result = 0;
   char *error = strerror_worker (errnum);
+  char tmp[sizeof "Unknown error -2147483648"];
   if (!error)
     {
-      __small_sprintf (error = _my_tls.locals.strerror_buf, "Unknown error %u",
-                      (unsigned) errnum);
+      __small_sprintf (error = tmp, "Unknown error %d", errnum);
       result = EINVAL;
     }
   if (strlen (error) >= n)
This page took 0.03398 seconds and 5 git commands to generate.