From: hno <> Date: Sat, 6 Apr 2002 20:57:11 +0000 (+0000) Subject: Bugzilla #244: Remove reference to sys_nerr X-Git-Tag: SQUID_3_0_PRE1~1122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04b7f2e06886a2ebfafe48bb4c24ab067f37d6a3;p=thirdparty%2Fsquid.git Bugzilla #244: Remove reference to sys_nerr Patch by Allen Wittenauer / SUN. --- diff --git a/lib/util.c b/lib/util.c index a2d6b6936f..3e79dec572 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1,6 +1,6 @@ /* - * $Id: util.c,v 1.84 2002/04/06 08:49:26 adrian Exp $ + * $Id: util.c,v 1.85 2002/04/06 13:57:11 hno Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -630,10 +630,14 @@ const char * xstrerror(void) { static char xstrerror_buf[BUFSIZ]; - if (errno < 0 || errno >= sys_nerr) - snprintf(xstrerror_buf, BUFSIZ, "(%d) Unknown", errno); + static char strerror_buf[BUFSIZ]; + + snprintf(strerror_buf, BUFSIZ, "%s", strerror(errno)); + + if (strerror_buf) + snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", errno, strerror_buf); else - snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", errno, strerror(errno)); + snprintf(xstrerror_buf, BUFSIZ, "(%d) Unknown", errno); return xstrerror_buf; }