X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=32ca4b2677a3808adcda2e9a4a28754205c20e89;hb=b53d4e59bf0a980aa774dcccc27123986e77b8ff;hp=88daf45aa40140bcc38715271cd4dd655c6c3a2e;hpb=a7a533cd65d544e8beebabcca5fe906e27af4707;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 88daf45aa..32ca4b267 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -4,20 +4,10 @@ * Linux Trace Toolkit Control Library * * Copyright (C) 2011 David Goulet - * Copyright (C) 2016 - Jérémie Galarneau + * Copyright (C) 2016 Jérémie Galarneau * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define _LGPL_SOURCE @@ -906,7 +896,7 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev) /* Add loglevel filtering if any for the JUL domain. */ if (ev->loglevel_type != LTTNG_EVENT_LOGLEVEL_ALL) { - char *op; + const char *op; if (ev->loglevel_type == LTTNG_EVENT_LOGLEVEL_RANGE) { op = ">="; @@ -2943,7 +2933,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, int *_enabled, int32_t **_pids, size_t *_nr_pids) { struct lttng_tracker_ids *ids = NULL; - size_t nr_ids = 0; + unsigned int nr_ids = 0; int *pids = NULL; int ret = 0, i; enum lttng_tracker_id_status status; @@ -2954,7 +2944,11 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, return ret; } - nr_ids = lttng_tracker_ids_get_count(ids); + status = lttng_tracker_ids_get_count(ids, &nr_ids); + if (status != LTTNG_TRACKER_ID_STATUS_OK) { + ret = -LTTNG_ERR_INVALID; + goto end; + } if (nr_ids == 1) { id = lttng_tracker_ids_get_at_index(ids, 0); @@ -3130,7 +3124,7 @@ static int lttng_track_untrack_id(struct lttng_handle *handle, { int ret; struct lttcomm_session_msg lsm; - const char *var_data; + const char *var_data = NULL; size_t var_data_len = 0; int value; enum lttng_tracker_id_status status;