From: David Goulet Date: Thu, 28 Apr 2011 18:49:10 +0000 (-0400) Subject: Make code simpler for send buffer header size X-Git-Tag: v2.0-pre1~170 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7e6e59cdaccc23e1e69166490f7167a396748d69;p=lttng-tools.git Make code simpler for send buffer header size Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/ltt-sessiond.c b/ltt-sessiond/ltt-sessiond.c index 275088f07..4f9ca1bd4 100644 --- a/ltt-sessiond/ltt-sessiond.c +++ b/ltt-sessiond/ltt-sessiond.c @@ -684,6 +684,7 @@ static int process_client_msg(int sock, struct lttcomm_session_msg *lsm) { int ret; int buf_size; + size_t header_size; char *send_buf = NULL; struct lttcomm_lttng_msg llm; @@ -704,12 +705,13 @@ static int process_client_msg(int sock, struct lttcomm_session_msg *lsm) } } - /* Default return code. * In our world, everything is OK... right? ;) */ llm.ret_code = LTTCOMM_OK; + header_size = sizeof(struct lttcomm_lttng_msg); + /* Process by command type */ switch (lsm->cmd_type) { case LTTNG_CREATE_SESSION: @@ -771,7 +773,7 @@ static int process_client_msg(int sock, struct lttcomm_session_msg *lsm) goto end; } - get_list_apps((pid_t *)(send_buf + sizeof(struct lttcomm_lttng_msg))); + get_list_apps((pid_t *)(send_buf + header_size)); break; } @@ -791,7 +793,7 @@ static int process_client_msg(int sock, struct lttcomm_session_msg *lsm) goto end; } - get_list_sessions((struct lttng_session *)(send_buf + sizeof(struct lttcomm_lttng_msg))); + get_list_sessions((struct lttng_session *)(send_buf + header_size)); break; }