From: Ronnie Sahlberg Date: Wed, 12 Mar 2014 12:54:38 +0000 (-0700) Subject: We only need to spend CPU computing a new error string IFF there was an error X-Git-Tag: upstream/1.9.6^2~82 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=b25c3aedde336822cf58c6ac72d53799244e60bc We only need to spend CPU computing a new error string IFF there was an error when unmarshalling the reply. --- diff --git a/lib/libnfs-zdr.c b/lib/libnfs-zdr.c index 7c971e0..c32f661 100644 --- a/lib/libnfs-zdr.c +++ b/lib/libnfs-zdr.c @@ -456,16 +456,18 @@ static bool_t libnfs_rpc_msg(struct rpc_context *rpc, ZDR *zdrs, struct rpc_msg switch (msg->direction) { case CALL: ret = libnfs_rpc_call_body(rpc, zdrs, &msg->body.cbody); - rpc_set_error(rpc, "libnfs_rpc_msg failed to encode CALL, " - "ret=%d: %s", ret, rpc_get_error(rpc)); + if (!ret) { + rpc_set_error(rpc, "libnfs_rpc_msg failed to encode " + "CALL, ret=%d: %s", ret, rpc_get_error(rpc)); + } return ret; - break; case REPLY: ret = libnfs_rpc_reply_body(rpc, zdrs, &msg->body.rbody); - rpc_set_error(rpc, "libnfs_rpc_msg failed to decode REPLY, " - "ret=%d: %s", ret, rpc_get_error(rpc)); + if (!ret) { + rpc_set_error(rpc, "libnfs_rpc_msg failed to decode " + "REPLY, ret=%d: %s", ret, rpc_get_error(rpc)); + } return ret; - break; default: rpc_set_error(rpc, "libnfs_rpc_msg failed to decode. " "Neither CALL not REPLY");