Fix: make lttng expand path for trace output opt
[lttng-tools.git] / src / bin / lttng / commands / create.c
index fcf6e128941877a46322827b046e3d79e5043c6d..2778ef553cdd2a24c27567f780be0b1c950678c6 100644 (file)
@@ -28,6 +28,8 @@
 #include "../command.h"
 #include "../utils.h"
 
+#include <common/sessiond-comm/sessiond-comm.h>
+
 static char *opt_output_path;
 static char *opt_session_name;
 
@@ -113,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;
        }
 
This page took 0.022751 seconds and 4 git commands to generate.