From: Ken Raeburn Date: Thu, 8 Mar 2001 03:19:21 +0000 (+0000) Subject: use strerror when available, for sparcv9-solaris2.8 X-Git-Tag: krb5-1.3-alpha1~1639 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1deb0c424386a8a264af8c5f70c83f1d9c9fda2a;p=krb5.git use strerror when available, for sparcv9-solaris2.8 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13059 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index 02f3b1aae..adca3e62b 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,11 @@ +2001-03-07 Ken Raeburn + + * configure.in: Check for strerror. + * clnt_perror.c (strerror, sys_nerr) [!HAVE_STRERROR]: Define. + (sys_nerr) [HAVE_STRERROR]: Declare at top level instead of in + clnt_spcreateerror. + (clnt_sperror, clnt_spcreateerror): Use strerror always. + Sun Feb 18 17:48:35 2001 Ezra Peisach * xdr.h: Flush out prototypes for xdrmem_create(), diff --git a/src/lib/rpc/clnt_perror.c b/src/lib/rpc/clnt_perror.c index 06dd22e96..828f5a32f 100644 --- a/src/lib/rpc/clnt_perror.c +++ b/src/lib/rpc/clnt_perror.c @@ -45,9 +45,17 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; #include #include +#ifndef HAVE_STRERROR #ifdef NEED_SYS_ERRLIST extern char *sys_errlist[]; #endif +#undef sys_nerr +#define sys_nerr 99999 /* XXX */ +#undef strerror +#define strerror(N) sys_errlist[N] +#else +extern int sys_nerr; +#endif /* HAVE_STRERROR */ static char *auth_errmsg(); @@ -108,9 +116,9 @@ clnt_sperror(rpch, s) case RPC_CANTSEND: case RPC_CANTRECV: /* 10 for the string */ - if(str - bufstart + 10 + strlen(sys_errlist[e.re_errno]) < BUFSIZ) + if(str - bufstart + 10 + strlen(strerror(e.re_errno)) < BUFSIZ) (void) sprintf(str, "; errno = %s", - sys_errlist[e.re_errno]); + strerror(e.re_errno)); str += strlen(str); break; @@ -251,7 +259,6 @@ char * clnt_spcreateerror(s) char *s; { - extern int sys_nerr; char *str = _buf(); if (str == 0) @@ -272,7 +279,7 @@ clnt_spcreateerror(s) if (rpc_createerr.cf_error.re_errno > 0 && rpc_createerr.cf_error.re_errno < sys_nerr) (void) strncat(str, - sys_errlist[rpc_createerr.cf_error.re_errno], + strerror(rpc_createerr.cf_error.re_errno), BUFSIZ - 1 - strlen(str)); else (void) sprintf(&str[strlen(str)], "Error %d", diff --git a/src/lib/rpc/configure.in b/src/lib/rpc/configure.in index f4b9f9e05..a4e2cfd0e 100644 --- a/src/lib/rpc/configure.in +++ b/src/lib/rpc/configure.in @@ -49,6 +49,8 @@ AC_CHECK_SIZEOF(long) SIZEOF_LONG=$ac_cv_sizeof_long AC_SUBST(SIZEOF_LONG) +AC_CHECK_FUNCS(strerror) + AC_MSG_CHECKING([return type of setrpcent]) AC_CACHE_VAL(k5_cv_type_setrpcent, [AC_TRY_COMPILE([#include