Fix: warning 'fd' may be used uninitialized
[lttng-tools.git] / src / bin / lttng-sessiond / save.c
index b9bcc666d797cf0bb97fc0ec88c5eff2e508a141..c51338e1758c519a19710ed0334699e9f1af04eb 100644 (file)
@@ -115,6 +115,13 @@ int save_kernel_channel_attributes(struct config_writer *writer,
                if (ret) {
                        goto end;
                }
+
+               ret = config_writer_write_element_signed_int(writer,
+                               config_element_blocking_timeout,
+                               ext->blocking_timeout);
+               if (ret) {
+                       goto end;
+               }
        }
 
 end:
@@ -171,6 +178,13 @@ int save_ust_channel_attributes(struct config_writer *writer,
                goto end;
        }
 
+       ret = config_writer_write_element_signed_int(writer,
+                       config_element_blocking_timeout,
+                       attr->u.s.blocking_timeout);
+       if (ret) {
+               goto end;
+       }
+
        /*
         * Fetch the monitor timer which is located in the parent of
         * lttng_ust_channel_attr
@@ -201,13 +215,13 @@ const char *get_kernel_instrumentation_string(
                instrumentation_string = config_event_type_tracepoint;
                break;
        case LTTNG_KERNEL_KPROBE:
-               instrumentation_string = config_event_type_kprobe;
+               instrumentation_string = config_event_type_probe;
                break;
        case LTTNG_KERNEL_FUNCTION:
-               instrumentation_string = config_event_type_function;
+               instrumentation_string = config_event_type_function_entry;
                break;
        case LTTNG_KERNEL_KRETPROBE:
-               instrumentation_string = config_event_type_kretprobe;
+               instrumentation_string = config_event_type_function;
                break;
        case LTTNG_KERNEL_NOOP:
                instrumentation_string = config_event_type_noop;
@@ -1876,8 +1890,7 @@ static
 int save_session(struct ltt_session *session,
        struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
 {
-       int ret, fd;
-       unsigned int file_opened = 0;   /* Indicate if the file has been opened */
+       int ret, fd = -1;
        char config_file_path[PATH_MAX];
        size_t len;
        struct config_writer *writer = NULL;
@@ -1970,7 +1983,6 @@ int save_session(struct ltt_session *session,
                ret = LTTNG_ERR_SAVE_IO_FAIL;
                goto end;
        }
-       file_opened = 1;
 
        writer = config_writer_create(fd, 1);
        if (!writer) {
@@ -2075,12 +2087,12 @@ end:
        }
        if (ret) {
                /* Delete file in case of error */
-               if (file_opened && unlink(config_file_path)) {
+               if ((fd >= 0) && unlink(config_file_path)) {
                        PERROR("Unlinking XML session configuration.");
                }
        }
 
-       if (file_opened) {
+       if (fd >= 0) {
                ret = close(fd);
                if (ret) {
                        PERROR("Closing XML session configuration");
This page took 0.02455 seconds and 5 git commands to generate.