X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcreate.c;h=b266c10a9397a8e250c0c156a5d7e2fef547db46;hb=a0377dfefe40662ba7d68617bce6ff467114136c;hp=438e88f4cadfeaa18e259d86047f40b9c88db2a8;hpb=973ad93ec5c6cc4c373cdae2d3ef8313d0a64cb5;p=lttng-tools.git diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 438e88f4c..b266c10a9 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -1,23 +1,12 @@ /* - * Copyright (C) 2011 - David Goulet - * Copyright (C) 2019 - Jérémie Galarneau + * Copyright (C) 2011 David Goulet + * Copyright (C) 2019 Jérémie Galarneau * - * 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 -#include #include #include #include @@ -39,8 +28,7 @@ #include #include #include -#include -#include +#include static char *opt_output_path; static char *opt_session_name; @@ -100,8 +88,8 @@ static int mi_created_session(const char *session_name) struct lttng_session *sessions; /* session_name should not be null */ - assert(session_name); - assert(writer); + LTTNG_ASSERT(session_name); + LTTNG_ASSERT(writer); count = lttng_list_sessions(&sessions); if (count < 0) { @@ -143,7 +131,6 @@ end: static struct lttng_session_descriptor *create_session_descriptor(void) { - int ret; ssize_t uri_count; enum output_type output_type; struct lttng_uri *uris = NULL; @@ -155,6 +142,7 @@ struct lttng_session_descriptor *create_session_descriptor(void) output_type = OUTPUT_NONE; } else if (opt_output_path) { char *expanded_output_path; + int ret; output_type = OUTPUT_LOCAL; expanded_output_path = utils_expand_path(opt_output_path); @@ -171,6 +159,8 @@ struct lttng_session_descriptor *create_session_descriptor(void) goto end; } } else if (opt_url || opt_ctrl_url) { + int ret; + uri_str1 = opt_ctrl_url ? opt_ctrl_url : opt_url; uri_str2 = opt_data_url; @@ -511,7 +501,7 @@ error: * * Spawn a session daemon by forking and execv. */ -static int spawn_sessiond(char *pathname) +static int spawn_sessiond(const char *pathname) { int ret = 0; pid_t pid; @@ -590,7 +580,7 @@ end: static int launch_sessiond(void) { int ret; - char *pathname = NULL; + const char *pathname = NULL; ret = lttng_session_daemon_alive(); if (ret) { @@ -637,6 +627,7 @@ end: return ret; } +static int validate_url_option_combination(void) { int ret = 0;