Make code simpler for send buffer header size
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 28 Apr 2011 18:49:10 +0000 (14:49 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 28 Apr 2011 18:49:10 +0000 (14:49 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/ltt-sessiond.c

index 275088f075e959fcfe07ddbd966c73c060646fdd..4f9ca1bd4d2e45396edbbe367a165dca50af3830 100644 (file)
@@ -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;
                }
This page took 0.026032 seconds and 4 git commands to generate.