Remove unused session current_archive_location accessor
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index eff08df80ee937c46177765bf518f739a1d5d2a7..b57be223a73afce55723c858c66a5aedfa245b24 100644 (file)
@@ -1959,6 +1959,11 @@ int lttng_list_events(struct lttng_handle *handle,
                goto end;
        }
 
+       if (!cmd_header) {
+               ret = -LTTNG_ERR_UNK;
+               goto end;
+       }
+
        /* Set number of events and free command header */
        nb_events = cmd_header->nb_events;
        if (nb_events > INT_MAX) {
@@ -2034,7 +2039,6 @@ int lttng_list_events(struct lttng_handle *handle,
 
                        probe_storage_req = ret;
                        comm_ext_at += ext_comm->userspace_probe_location_len;
-                       ret = 0;
                }
 
                storage_req += sizeof(struct lttng_event_extended);
@@ -2110,6 +2114,7 @@ int lttng_list_events(struct lttng_handle *handle,
                                        ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN);
                        if (ret) {
                                ret = -LTTNG_ERR_NOMEM;
+                               goto free_dynamic_buffer;
                        }
                        comm_ext_at += ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN;
                }
@@ -2739,6 +2744,9 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
                return ret;
        }
        nr_pids = ret / sizeof(int32_t);
+       if (nr_pids > 0 && !pids) {
+               return -LTTNG_ERR_UNK;
+       }
        if (nr_pids == 1 && pids[0] == -1) {
                free(pids);
                pids = NULL;
@@ -2885,50 +2893,6 @@ end:
        return ret;
 }
 
-int lttng_session_get_current_archive_location(const char *session_name,
-               char **chunk_path)
-{
-       struct lttcomm_session_msg lsm;
-       struct lttng_session_get_current_output_return *output_return = NULL;
-       int ret;
-       size_t path_len;
-
-       memset(&lsm, 0, sizeof(lsm));
-       lsm.cmd_type = LTTNG_SESSION_GET_CURRENT_OUTPUT;
-       ret = lttng_strncpy(lsm.session.name, session_name,
-                       sizeof(lsm.session.name));
-       if (ret) {
-               ret = -LTTNG_ERR_INVALID;
-               goto end;
-       }
-
-       ret = lttng_ctl_ask_sessiond(&lsm, (void **) &output_return);
-       if (ret < 0) {
-               ret = -1;
-               goto end;
-       }
-
-       path_len = lttng_strnlen(output_return->path,
-                       sizeof(output_return->path));
-       if (path_len == 0 || path_len == sizeof(output_return->path)) {
-               ret = -LTTNG_ERR_NO_SESSION_OUTPUT;
-               goto end;
-       }
-
-       *chunk_path = zmalloc(path_len + 1);
-       if (!*chunk_path) {
-               ret = -1;
-               goto end;
-       }
-       memcpy(*chunk_path, output_return->path, path_len);
-
-       ret = 0;
-
-end:
-       free(output_return);
-       return ret;
-}
-
 /*
  * lib constructor.
  */
This page took 0.026024 seconds and 5 git commands to generate.