X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fview.c;h=e3eff22ca394c6680babf7ef75a064bb7bc53b83;hp=430f8b62cfd208375691f3dda72ceb64f9ee881a;hb=c617c0c651432f9d5ae7adf4c5c1a5fd92ad828e;hpb=32a6298d8929c91842c9a5c09f1a3f4660c32eec diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index 430f8b62c..e3eff22ca 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -278,7 +278,7 @@ error: */ static int view_trace(void) { - int ret, count, i, found = 0; + int ret; char *session_name, *trace_path; struct lttng_session *sessions = NULL; @@ -314,6 +314,8 @@ static int view_trace(void) DBG("Viewing trace for session %s", session_name); if (session_name) { + int i, count, found = 0; + /* Getting all sessions */ count = lttng_list_sessions(&sessions); if (count < 0) { @@ -339,6 +341,13 @@ static int view_trace(void) } trace_path = sessions[i].path; + + if (sessions[i].enabled) { + WARN("Session %s is running. Please stop it before reading it.", + session_name); + ret = CMD_ERROR; + goto free_sessions; + } } else { trace_path = opt_trace_path; }