diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-06-16 12:35:17 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-06-16 12:35:17 +0000 |
commit | 8c4cde617955e142623f8ab0f9f3e5a16324d728 (patch) | |
tree | 1b6c6bb0516f2e2717f44c2c7108067060445e76 | |
parent | fd67d75e4d7b1e0a38cac821e28b047cadd3e811 (diff) | |
download | FreeBSD-src-8c4cde617955e142623f8ab0f9f3e5a16324d728.zip FreeBSD-src-8c4cde617955e142623f8ab0f9f3e5a16324d728.tar.gz |
Our strerror_r(3) returns int, not char *. This fixes bogus error messages
like "Cannot stat: (null)"
Reported by: bde, kris
-rw-r--r-- | contrib/tar/lib/error.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/tar/lib/error.c b/contrib/tar/lib/error.c index 2153194..e91e68a 100644 --- a/contrib/tar/lib/error.c +++ b/contrib/tar/lib/error.c @@ -19,6 +19,8 @@ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ +/* $FreeBSD$ */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -188,7 +190,10 @@ error_tail (int status, int errnum, const char *message, va_list args) { # if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; - char *s = __strerror_r (errnum, errbuf, sizeof errbuf); + /* Don't use __strerror_r's return value because on some systems + (at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */ + (void)__strerror_r (errnum, errbuf, sizeof errbuf); + char *s = errbuf; # if _LIBC && USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L": %s", s); |