Improve error handling of lttng cli
[lttng-tools.git] / src / bin / lttng / commands / stop.c
index 689fe1b04998f8451d8c5018670ab5d1b25f1f65..f2ab453084f489cd38fe3cf2812a92278a05e296 100644 (file)
@@ -61,7 +61,7 @@ static void usage(FILE *ofp)
  */
 static int stop_tracing(void)
 {
-       int ret = CMD_SUCCESS;
+       int ret;
        char *session_name;
 
        if (opt_session_name == NULL) {
@@ -76,9 +76,12 @@ static int stop_tracing(void)
 
        ret = lttng_stop_tracing(session_name);
        if (ret < 0) {
+               /* Don't set ret so lttng can interpret the sessiond error. */
                goto free_name;
        }
 
+       ret = CMD_SUCCESS;
+
        MSG("Tracing stopped for session %s", session_name);
 
 free_name:
This page took 0.022745 seconds and 4 git commands to generate.