From: Jérémie Galarneau Date: Tue, 9 Feb 2021 23:36:30 +0000 (-0500) Subject: lttng-ctl: convert invalid command return codes to LTTNG_ERR_UNK X-Git-Tag: v2.13.0-rc1~347 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=eb441106665e76ce743f9086b1dc37e23a0ac0e9;p=lttng-tools.git lttng-ctl: convert invalid command return codes to LTTNG_ERR_UNK Signed-off-by: Jérémie Galarneau Change-Id: I6dd1ff37ea6f889fb6c70282fd774029f80cfc2b --- diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 151ceed64..d0a117f4b 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -653,7 +653,12 @@ int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message, /* Check error code if OK */ if (llm.ret_code != LTTNG_OK) { - ret = -llm.ret_code; + if (llm.ret_code < LTTNG_OK || llm.ret_code >= LTTNG_ERR_NR) { + /* Invalid error code received. */ + ret = -LTTNG_ERR_UNK; + } else { + ret = -llm.ret_code; + } goto end; }