Fix lttng bug having the wrong sessiond path
[lttng-tools.git] / liblttngctl / liblttngctl.c
index 1793bc53ad44a23195157427b30950f85bb8e9d6..e400775eaa97a6ffcd983cf4f6cd14da695ec18b 100644 (file)
@@ -39,7 +39,7 @@ static struct lttcomm_lttng_msg llm;
 
 /* Prototypes */
 static int check_tracing_group(const char *grp_name);
-static int ask_sessiond(enum lttcomm_command_type lct, void **buf);
+static int ask_sessiond(enum lttcomm_sessiond_command lct, void **buf);
 static int recv_data_sessiond(void *buf, size_t len);
 static int send_data_sessiond(void);
 static int set_session_daemon_path(void);
@@ -105,7 +105,7 @@ end:
  *
  *  Return size of data (only payload, not header).
  */
-static int ask_sessiond(enum lttcomm_command_type lct, void **buf)
+static int ask_sessiond(enum lttcomm_sessiond_command lct, void **buf)
 {
        int ret;
        size_t size;
@@ -136,7 +136,7 @@ static int ask_sessiond(enum lttcomm_command_type lct, void **buf)
                goto end;
        }
 
-       size = llm.size_payload;
+       size = llm.trace_name_offset + llm.data_size;
        if (size == 0) {
                goto end;
        }
@@ -250,7 +250,7 @@ int lttng_list_traces(uuid_t *uuid, struct lttng_trace **traces)
 {
        int ret;
 
-       uuid_copy(lsm.session_id, *uuid);
+       uuid_copy(lsm.session_uuid, *uuid);
 
        ret = ask_sessiond(LTTNG_LIST_TRACES, (void **) traces);
        if (ret < 0) {
@@ -278,7 +278,7 @@ int lttng_create_session(char *name, uuid_t *session_id)
                goto end;
        }
 
-       uuid_copy(*session_id, llm.session_id);
+       uuid_copy(*session_id, llm.session_uuid);
 
 end:
        return ret;
@@ -293,7 +293,7 @@ int lttng_destroy_session(uuid_t *uuid)
 {
        int ret;
 
-       uuid_copy(lsm.session_id, *uuid);
+       uuid_copy(lsm.session_uuid, *uuid);
 
        ret = ask_sessiond(LTTNG_DESTROY_SESSION, NULL);
        if (ret < 0) {
@@ -377,7 +377,7 @@ int lttng_disconnect_sessiond(void)
  */
 void lttng_set_current_session_uuid(uuid_t *uuid)
 {
-       uuid_copy(lsm.session_id, *uuid);
+       uuid_copy(lsm.session_uuid, *uuid);
 }
 
 /*
@@ -431,7 +431,7 @@ static int set_session_daemon_path(void)
 
        /* Are we in the tracing group ? */
        ret = check_tracing_group(tracing_group);
-       if (ret < 0) {
+       if (ret < 0 && getuid() != 0) {
                if (sprintf(sessiond_sock_path, DEFAULT_HOME_CLIENT_UNIX_SOCK,
                                        getenv("HOME")) < 0) {
                        return -ENOMEM;
This page took 0.024675 seconds and 4 git commands to generate.