* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: clnt_perror.c,v 1.5 1996/12/19 18:38:40 deraadt Exp $";
+static char *rcsid = "$OpenBSD: clnt_perror.c,v 1.6 1997/01/21 06:07:22 millert Exp $";
#endif /* LIBC_SCCS and not lint */
/*
return (0);
CLNT_GETERR(rpch, &e);
- (void) sprintf(str, "%s: %s", s, clnt_sperrno(e.re_status));
+ (void) snprintf(str, CLNT_PERROR_BUFLEN, "%s: %s", s,
+ clnt_sperrno(e.re_status));
str += strlen(str);
switch (e.re_status) {
case RPC_SUCCESS:
case RPC_CANTENCODEARGS:
case RPC_CANTDECODERES:
- case RPC_TIMEDOUT:
+ case RPC_TIMEDOUT:
case RPC_PROGUNAVAIL:
case RPC_PROCUNAVAIL:
case RPC_CANTDECODEARGS:
break;
case RPC_VERSMISMATCH:
- (void) sprintf(str,
- "; low version = %lu, high version = %lu\n",
+ (void) snprintf(str, CLNT_PERROR_BUFLEN - (str - strstart),
+ "; low version = %lu, high version = %lu\n",
e.re_vers.low, e.re_vers.high);
break;
case RPC_AUTHERROR:
err = auth_errmsg(e.re_why);
- (void) sprintf(str, "; why = ");
+ (void) snprintf(str, CLNT_PERROR_BUFLEN - (str - strstart),
+ "; why = ");
str += strlen(str);
if (err != NULL) {
- (void) sprintf(str, "%s\n", err);
+ (void) snprintf(str, CLNT_PERROR_BUFLEN -
+ (str - strstart), "%s\n", err);
} else {
- (void) sprintf(str,
+ (void) snprintf(str, CLNT_PERROR_BUFLEN -
+ (str - strstart),
"(unknown authentication error - %d)\n",
(int) e.re_why);
}
break;
case RPC_PROGVERSMISMATCH:
- (void) sprintf(str,
+ (void) snprintf(str, CLNT_PERROR_BUFLEN - (str - strstart),
"; low version = %lu, high version = %lu\n",
e.re_vers.low, e.re_vers.high);
break;
default: /* unknown */
- (void) sprintf(str,
+ (void) snprintf(str, CLNT_PERROR_BUFLEN - (str - strstart),
"; s1 = %lu, s2 = %lu\n",
e.re_lb.s1, e.re_lb.s2);
- str += strlen(str);
break;
}
strstart[CLNT_PERROR_BUFLEN-2] = '\n';
strstart[CLNT_PERROR_BUFLEN-1] = '\0';
- return(strstart);
+ return (strstart) ;
}
void
CLIENT *rpch;
char *s;
{
- (void) fprintf(stderr,"%s\n",clnt_sperror(rpch,s));
+ (void) fprintf(stderr, "%s\n", clnt_sperror(rpch, s));
}
static const char *const rpc_errlist[] = {
clnt_perrno(num)
enum clnt_stat num;
{
- (void) fprintf(stderr,"%s\n",clnt_sperrno(num));
+ (void) fprintf(stderr, "%s\n", clnt_sperrno(num));
}
char *str = _buf();
if (str == 0)
- return(0);
+ return (0);
+
switch (rpc_createerr.cf_stat) {
case RPC_PMAPFAILURE:
(void) snprintf(str, CLNT_PERROR_BUFLEN, "%s: %s - %s\n", s,
clnt_sperrno(rpc_createerr.cf_stat),
clnt_sperrno(rpc_createerr.cf_error.re_status));
break;
+
case RPC_SYSTEMERROR:
(void) snprintf(str, CLNT_PERROR_BUFLEN, "%s: %s - %s\n", s,
clnt_sperrno(rpc_createerr.cf_stat),
strerror(rpc_createerr.cf_error.re_errno));
break;
+
default:
(void) snprintf(str, CLNT_PERROR_BUFLEN, "%s: %s\n", s,
clnt_sperrno(rpc_createerr.cf_stat));
clnt_pcreateerror(s)
char *s;
{
- (void) fprintf(stderr,"%s\n",clnt_spcreateerror(s));
+ (void) fprintf(stderr, "%s\n", clnt_spcreateerror(s));
}
static const char *const auth_errlist[] = {
if (errnum < (sizeof(auth_errlist)/sizeof(auth_errlist[0])))
return (char *)auth_errlist[errnum];
- return(NULL);
+ return (NULL);
}