use strerror when available, for sparcv9-solaris2.8
authorKen Raeburn <raeburn@mit.edu>
Thu, 8 Mar 2001 03:19:21 +0000 (03:19 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 8 Mar 2001 03:19:21 +0000 (03:19 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13059 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/rpc/ChangeLog
src/lib/rpc/clnt_perror.c
src/lib/rpc/configure.in

index 02f3b1aae8c60eb243fb86a7fbbc47a289c82e9b..adca3e62b5184b0d351c56ca620ff6fe63c4cd98 100644 (file)
@@ -1,3 +1,11 @@
+2001-03-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <epeisach@kangaroo.mit.edu>
 
        * xdr.h: Flush out prototypes for xdrmem_create(),
index 06dd22e962cbd48be0dc4e62e9a60fbca3eb6e6a..828f5a32f4780f704d07a4d735df94a64825b844 100644 (file)
@@ -45,9 +45,17 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
 #include <gssrpc/auth.h>
 #include <gssrpc/clnt.h>
 
+#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",
index f4b9f9e050c6a1e9733d69f67becb05e3ae0b571..a4e2cfd0e669b817d8a8aab2f1a2b672567bd538 100644 (file)
@@ -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 <netdb.h>