X-Git-Url: http://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=5b774e1d6bcbc1e9df4c01efc0e98634e1172e72;hp=38df4cb7b11c1234c5b33f8b92d1731ea541585f;hb=b22f4f54e95ae13edda1d4d5efd1e4845a6319c4;hpb=e1b624d005769d1a2e9eb39fee63c73c6395fd76 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 38df4cb7b..5b774e1d6 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -116,7 +116,8 @@ static int send_session_msg(struct lttcomm_session_msg *lsm) 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)); @@ -652,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; } @@ -3141,18 +3147,18 @@ int lttng_register_trigger(struct lttng_trigger *trigger) 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); {