From: Mathieu Desnoyers Date: Tue, 25 Aug 2015 11:12:51 +0000 (-0400) Subject: Cleanup: more descriptive error message X-Git-Tag: v2.8.0-rc1~102 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5dafeeaa324690afac7c81ab7583523c907f2483;p=lttng-ust.git Cleanup: more descriptive error message Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index 751ad2e3..631ff42f 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -515,19 +515,27 @@ int ustcomm_recv_app_reply(int sock, struct ustcomm_ust_reply *lur, case 0: /* orderly shutdown */ return -EPIPE; case sizeof(*lur): + { + int err = 0; + if (lur->handle != expected_handle) { ERR("Unexpected result message handle: " "expected: %u vs received: %u\n", expected_handle, lur->handle); - return -EINVAL; + err = 1; } if (lur->cmd != expected_cmd) { ERR("Unexpected result message command " "expected: %u vs received: %u\n", expected_cmd, lur->cmd); + err = 1; + } + if (err) { return -EINVAL; + } else { + return lur->ret_code; } - return lur->ret_code; + } default: if (len >= 0) { ERR("incorrect message size: %zd\n", len);