From ca690f98020f75758bc26f4b5ef1ccf0472a27c3 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 1 Nov 2001 00:48:05 +0000 Subject: [PATCH] 1085. [port] libbind: solaris: sys_nerr and sys_errlist do not exist when compiling in 64 bit mode. --- CHANGES | 3 +++ lib/bind/bsd/strerror.c | 16 +++++++++++++--- lib/bind/configure.in | 6 +++++- lib/bind/port_after.h.in | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 3e6752d4ee..021599bb2a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1085. [port] libbind: solaris: sys_nerr and sys_errlist do not + exist when compiling in 64 bit mode. + 1084. [cleanup] libbind: gai_strerror() re-written. 1083. [bug] The default control channel listened on the diff --git a/lib/bind/bsd/strerror.c b/lib/bind/bsd/strerror.c index 975f6b34f3..bddcb9e3ea 100644 --- a/lib/bind/bsd/strerror.c +++ b/lib/bind/bsd/strerror.c @@ -1,6 +1,6 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: strerror.c,v 1.3 2001/06/21 08:25:59 marka Exp $"; +static const char rcsid[] = "$Id: strerror.c,v 1.4 2001/11/01 00:48:03 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -49,6 +49,11 @@ static const char rcsid[] = "$Id: strerror.c,v 1.3 2001/06/21 08:25:59 marka Exp int __strerror_unneeded__; #else +#ifdef USE_SYSERROR_LIST +extern int sys_nerr; +extern char *sys_errlist[]; +#endif + const char * isc_strerror(int num) { #define UPREFIX "Unknown error: " @@ -58,12 +63,17 @@ isc_strerror(int num) { const char *ret; char tmp[40]; + errnum = num; /* convert to unsigned */ +#ifdef USE_SYSERROR_LIST + if (errnum < sys_nerr) + return (sys_errlist[errnum]); +#else #undef strerror ret = strerror(num); /* call strerror() in libc */ if (ret != NULL) return(ret); - - errnum = num; /* convert to unsigned */ +#endif + /* Do this by hand, so we don't include stdio(3). */ t = tmp; do { diff --git a/lib/bind/configure.in b/lib/bind/configure.in index b16c84a725..4110e788cf 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.83 $) +AC_REVISION($Revision: 1.84 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -1265,6 +1265,10 @@ AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF) AC_SUBST(ISC_EXTRA_OBJS) AC_SUBST(ISC_EXTRA_SRCS) +AC_CHECK_FUNC(strerror, + [USE_SYSERROR_LIST="#undef USE_SYSERROR_LIST"], + [USE_SYSERROR_LIST="#define USE_SYSERROR_LIST 1"]) +AC_SUBST(USE_SYSERROR_LIST) # # Determine the printf format characters to use when printing diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index f396093b46..f120779e59 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -23,6 +23,7 @@ @NEED_GETTIMEOFDAY@ @HAVE_STRNDUP@ @USE_FIONBIO_IOCTL@ +@USE_SYSERROR_LIST@ /* XXX sunos and cygwin needs O_NDELAY */ #define PORT_NONBLOCK O_NONBLOCK