Fix: sessiond: return _OK on _SET_SESSION_SHM_PATH command success
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 11 Mar 2021 16:06:53 +0000 (11:06 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 11 Mar 2021 20:31:53 +0000 (15:31 -0500)
Issue
=====
When running the `test_crash` tests, I witness the following warning:
  Warning: Command returned an invalid status code, returning unknown error: command type = 40, ret = 0

The `cmd_set_session_shm_path()` function is returning 0 on success
instead of the expected LTTNG_OK which leads to this warning being
printed.

Fix
===
Return LTTNG_OK.

Side note
=========
I added the string version of the command name in the warning printing
for easier debugging.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I79fe41afd49a1c701e760e415b72aabdc9b25f6c

src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c

index d752fb94efe9b02bbdaffb2f71c6a1463ac196e0..770a2ee4464f0b6962b9bd731095823b1feb9021 100644 (file)
@@ -2618,7 +2618,10 @@ static void *thread_manage_clients(void *data)
                }
 
                if (ret < LTTNG_OK || ret >= LTTNG_ERR_NR) {
-                       WARN("Command returned an invalid status code, returning unknown error: command type = %d, ret = %d", cmd_ctx.lsm.cmd_type, ret);
+                       WARN("Command returned an invalid status code, returning unknown error: "
+                                       "command type = %s (%d), ret = %d",
+                                       lttcomm_sessiond_command_str(cmd_ctx.lsm.cmd_type),
+                                       cmd_ctx.lsm.cmd_type, ret);
                        ret = LTTNG_ERR_UNK;
                }
 
index 2d94204d37393c549a154a8d81f6fe8fcbf1b243..a6f1a4db64cbfc79947faf9517be805165bd1e99 100644 (file)
@@ -5124,7 +5124,7 @@ int cmd_set_session_shm_path(struct ltt_session *session,
                sizeof(session->shm_path));
        session->shm_path[sizeof(session->shm_path) - 1] = '\0';
 
-       return 0;
+       return LTTNG_OK;
 }
 
 /*
This page took 0.029903 seconds and 5 git commands to generate.