Fix: rename of perf counter context
[lttng-tools.git] / src / bin / lttng-sessiond / save.c
index 22fab9c05bd013020a83c368fc6a0cadf7ad09e3..18d303cac9184cbd82ba0671c4b92e75b8eb91e0 100644 (file)
@@ -25,7 +25,6 @@
 #include <common/defaults.h>
 #include <common/error.h>
 #include <common/config/config.h>
-#include <common/config/config-session-internal.h>
 #include <common/utils.h>
 #include <common/runas.h>
 #include <lttng/save-internal.h>
@@ -679,7 +678,7 @@ int save_kernel_context(struct config_writer *writer,
                goto end;
        }
 
-       if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_COUNTER) {
+       if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER) {
                ret = config_writer_open_element(writer, config_element_perf);
                if (ret) {
                        ret = LTTNG_ERR_SAVE_IO_FAIL;
@@ -1410,6 +1409,7 @@ int save_session(struct ltt_session *session,
        assert(creds);
 
        session_name_len = strlen(session->name);
+       memset(config_file_path, 0, sizeof(config_file_path));
 
        if (!session_access_ok(session,
                LTTNG_SOCK_GET_UID_CRED(creds),
@@ -1420,6 +1420,7 @@ int save_session(struct ltt_session *session,
 
        provided_path = lttng_save_session_attr_get_output_url(attr);
        if (provided_path) {
+               DBG3("Save session in provided path %s", provided_path);
                len = strlen(provided_path);
                if (len >= sizeof(config_file_path)) {
                        ret = LTTNG_ERR_SET_URL;
@@ -1472,9 +1473,12 @@ int save_session(struct ltt_session *session,
        strncpy(config_file_path + len, session->name, session_name_len);
        len += session_name_len;
        strcpy(config_file_path + len, DEFAULT_SESSION_CONFIG_FILE_EXTENSION);
+       len += sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION);
+       config_file_path[len] = '\0';
 
        if (!access(config_file_path, F_OK) && !attr->overwrite) {
-               /* A file with the same name already exists, skip */
+               /* File exists, notify the user since the overwrite flag is off. */
+               ret = LTTNG_ERR_SAVE_FILE_EXIST;
                goto end;
        }
 
@@ -1519,7 +1523,7 @@ int save_session(struct ltt_session *session,
        }
 
        ret = config_writer_write_element_bool(writer, config_element_started,
-                       session->enabled);
+                       session->active);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
This page took 0.02349 seconds and 4 git commands to generate.