X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fdestroy.c;h=03f10dac9666473043b1061530b5efa9c21e1ae2;hb=bdae7d71473289a9e50c8d03188bd90cec8a5d57;hp=3fb5fb232edb16184a4a7574de9b6e623668959f;hpb=4f65bee19fd9e7cf43c95ef01f963107577573cf;p=lttng-tools.git diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index 3fb5fb232..03f10dac9 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -27,6 +27,7 @@ #include "../command.h" #include +#include static char *opt_session_name; static int opt_destroy_all; @@ -70,6 +71,7 @@ static void usage(FILE *ofp) static int destroy_session(const char *session_name) { int ret; + char *default_session_name = NULL; ret = lttng_destroy_session(session_name); if (ret < 0) { @@ -85,9 +87,15 @@ static int destroy_session(const char *session_name) } MSG("Session %s destroyed", session_name); - config_destroy_default(); + + default_session_name = get_session_name_quiet(); + if (default_session_name && + !strncmp(session_name, session_name, NAME_MAX)) { + config_destroy_default(); + } ret = CMD_SUCCESS; error: + free(default_session_name); return ret; }