libtirpc/libtirpc-0.1.10-errmess-unlock.patch
2008-11-20 14:38:35 +00:00

47 lines
1.2 KiB
Diff

commit e145633cf10c92aa6f24b8a1a322435b4e874b02
Author: Steve Dickson <steved@redhat.com>
Date: Thu Nov 20 08:55:31 2008 -0500
Changed clnt_spcreateerror() to return clearer
and more concise error messages.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/clnt_perror.c b/src/clnt_perror.c
index 8f53f8e..1c1c705 100644
--- a/src/clnt_perror.c
+++ b/src/clnt_perror.c
@@ -239,7 +239,7 @@ char *
clnt_spcreateerror(s)
const char *s;
{
- char *str;
+ char *str, *err;
size_t len, i;
if (s == NULL)
@@ -257,8 +257,21 @@ clnt_spcreateerror(s)
switch (rpc_createerr.cf_stat) {
case RPC_PMAPFAILURE:
(void) strncat(str, " - ", len - 1);
- (void) strncat(str,
- clnt_sperrno(rpc_createerr.cf_error.re_status), len - 4);
+ err = clnt_sperrno(rpc_createerr.cf_error.re_status);
+ if (err)
+ (void) strncat(str, err+5, len-5);
+ switch(rpc_createerr.cf_error.re_status) {
+ case RPC_CANTSEND:
+ case RPC_CANTRECV:
+ i = strlen(str);
+ len -= i;
+ snprintf(str+i, len, ": errno %d (%s)",
+ rpc_createerr.cf_error.re_errno,
+ strerror(rpc_createerr.cf_error.re_errno));
+ break;
+ default:
+ break;
+ }
break;
case RPC_SYSTEMERROR: