lttng-ctl: fix: lttng_data_pending confuses communication status
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 8afa6a820bf73a14baf1d5e7c5cd021a7621599a..1a6e75acfea4286e8b8c5a6dddb25225190e8d7d 100644 (file)
@@ -2229,6 +2229,10 @@ int lttng_data_pending(const char *session_name)
                /* Unexpected payload size */
                ret = -LTTNG_ERR_INVALID;
                goto end;
+       } else if (!pending) {
+               /* Internal error. */
+               ret = -LTTNG_ERR_UNK;
+               goto end;
        }
 
        ret = (int) *pending;
@@ -2355,6 +2359,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;
This page took 0.030945 seconds and 4 git commands to generate.