X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Flive.c;h=3ddafe2a16fb0075c33cbf921b9fb91981cfa646;hp=eed82a6c86512b6acea63bf5a71704c73ae98b1f;hb=d546eeec57f3d23255e55d6d7384ab825bae8218;hpb=8bb66c3cd60938352927ee865759433387324250 diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index eed82a6c8..3ddafe2a1 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1,20 +1,10 @@ /* - * Copyright (C) 2013 - Julien Desfossez - * David Goulet - * 2015 - Mathieu Desnoyers + * Copyright (C) 2013 Julien Desfossez + * Copyright (C) 2013 David Goulet + * Copyright (C) 2015 Mathieu Desnoyers * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -571,7 +561,11 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name) ret = fd_tracker_open_unsuspendable_fd(the_fd_tracker, &sock_fd, (const char **) (formated_name ? &formated_name : NULL), 1, create_sock, sock); - free(formated_name); + if (ret) { + PERROR("Failed to create \"%s\" socket", + formated_name ?: "Unknown"); + goto error; + } DBG("Listening on %s socket %d", name, sock->fd); ret = sock->ops->bind(sock); @@ -586,12 +580,14 @@ struct lttcomm_sock *init_socket(struct lttng_uri *uri, const char *name) } + free(formated_name); return sock; error: if (sock) { lttcomm_destroy_sock(sock); } + free(formated_name); return NULL; } @@ -608,6 +604,7 @@ void *thread_listener(void *data) DBG("[thread] Relay live listener started"); + rcu_register_thread(); health_register(health_relayd, HEALTH_RELAYD_TYPE_LIVE_LISTENER); health_code_update(); @@ -749,6 +746,7 @@ error_sock_control: DBG("Live viewer listener thread exited with error"); } health_unregister(health_relayd); + rcu_unregister_thread(); DBG("Live viewer listener thread cleanup complete"); if (lttng_relay_stop_threads()) { ERR("Error stopping threads");