X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsave.c;h=d2db1edb92e593dcfc51dfc41b539477ae0f774a;hb=1a2f00926bff15c976cedc1a6f0ba5f061c9ea98;hp=1a879b21429892e1f1af1465af9c790b5f7270b5;hpb=d80b2057e3bc4f5e463ff76d83410add5134eba9;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index 1a879b214..d2db1edb9 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -174,13 +174,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; @@ -1849,8 +1849,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; @@ -1943,7 +1942,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) { @@ -2048,12 +2046,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");