goto end;
}
- DBG("LSM cmd type : %d", lsm->cmd_type);
+ DBG("LSM cmd type: '%s' (%d)", lttcomm_sessiond_command_str(lsm->cmd_type),
+ lsm->cmd_type);
ret = lttcomm_send_creds_unix_sock(sessiond_socket, lsm,
sizeof(struct lttcomm_session_msg));
/* 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;
}
goto end;
}
- /*
- * This is needed to populate the trigger object size for the command
- * header.
- */
- message_lsm = (struct lttcomm_session_msg *) message.buffer.data;
-
ret = lttng_trigger_serialize(trigger, &message);
if (ret < 0) {
ret = -LTTNG_ERR_UNK;
goto end;
}
+ /*
+ * This is needed to populate the trigger object size for the command
+ * header.
+ */
+ message_lsm = (struct lttcomm_session_msg *) message.buffer.data;
+
message_lsm->u.trigger.length = (uint32_t) message.buffer.size - sizeof(lsm);
{