strerror: match recent glibc changes

* errno.cc (strerror): Print unknown errno as int.
(__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
This commit is contained in:
Eric Blake 2011-05-23 20:43:06 +00:00
parent 38aa65b899
commit 4d95630803
2 changed files with 9 additions and 4 deletions

View 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.

View 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)