lttng-ctl: convert invalid command return codes to LTTNG_ERR_UNK
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Feb 2021 23:36:30 +0000 (18:36 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Feb 2021 23:39:19 +0000 (18:39 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6dd1ff37ea6f889fb6c70282fd774029f80cfc2b

src/lib/lttng-ctl/lttng-ctl.c

index 151ceed64ac3f02f86a043898b08e29de03b3e50..d0a117f4be1dba076b877b226162cf74fbc71ac3 100644 (file)
@@ -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;
        }
 
This page took 0.026366 seconds and 4 git commands to generate.