X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcreate.c;h=2778ef553cdd2a24c27567f780be0b1c950678c6;hp=8052826a245296b0d2d9c310165385a11c5f6ad9;hb=3badf2bf32930336a4902002d840402adb6859e1;hpb=ffbf37df326cbe1b2cb2ff27fae8fbff0c8f9bcc diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 8052826a2..2778ef553 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -1,19 +1,18 @@ /* * Copyright (C) 2011 - David Goulet * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; only version 2 - * of the License. + * 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. * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _GNU_SOURCE @@ -29,6 +28,8 @@ #include "../command.h" #include "../utils.h" +#include + static char *opt_output_path; static char *opt_session_name; @@ -114,12 +115,21 @@ static int create_session() goto error; } } else { - traces_path = opt_output_path; + traces_path = expand_full_path(opt_output_path); + if (traces_path == NULL) { + ret = CMD_ERROR; + goto error; + } } ret = lttng_create_session(session_name, traces_path); if (ret < 0) { /* Don't set ret so lttng can interpret the sessiond error. */ + switch (-ret) { + case LTTCOMM_EXIST_SESS: + WARN("Session %s already exists", session_name); + break; + } goto error; }