[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tar-1.13.25: HPUX 10.20 strerror_r() broken
From: |
Harald Koenig |
Subject: |
Re: tar-1.13.25: HPUX 10.20 strerror_r() broken |
Date: |
Fri, 19 Oct 2001 12:16:02 +0200 |
User-agent: |
Mutt/1.3.16i |
On Oct 19, Harald Koenig wrote:
> since strerror_r() writes to the buffer being passed,
> I don't see why to use/print the return value of strerror_r(),
> better use the buffer itself, this is more portable:
oops, I should have tested my patch on more platforms
before submitting it :-((
while it fixes the problems on HPUX, now Linux with glibc 2.[12]
got broken. looks like glibc doesn't use the supplied buffer
all the time (surprise;).
this new patch (ugly hack?) is one possible fix, tested for
10 platforms now:
-------------------------------------------------------------------------------
--- tar-1.13.25/lib/error.c.orig Fri Oct 19 11:43:27 2001
+++ tar-1.13.25/lib/error.c Fri Oct 19 12:13:55 2001
@@ -189,6 +189,8 @@
# if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
char *s = __strerror_r (errnum, errbuf, sizeof errbuf);
+ if (s == NULL) /* for broken HPUX 10.20 which returns (int)0 */
+ s = errbuf;
# if _LIBC && USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
__fwprintf (stderr, L": %s", s);
-------------------------------------------------------------------------------
sorry for the confusion,
Harald
--
"I hope to die ___ _____
before I *have* to use Microsoft Word.", 0--,| /OOOOOOO\
Donald E. Knuth, 21-09-2001 in Tuebingen. <_/ / /OOOOOOOOOOO\
\ \/OOOOOOOOOOOOOOO\
\ OOOOOOOOOOOOOOOOO|//
Harald Koenig \/\/\/\/\/\/\/\/\/
science+computing ag // / \\ \
address@hidden ^^^^^ ^^^^^