X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fconfig.c;h=e61791b7d03b01eafad109b66f319421bb1f7e16;hb=ebfa5166759c3b125a9d342e3fe1a227ba0fccf7;hp=13af2f117e7bf7306cdab4930d45a711da5312ab;hpb=7c6b168498857c3b359021114f7d3c2950051da1;p=lttng-tools.git diff --git a/src/common/config/config.c b/src/common/config/config.c index 13af2f117..e61791b7d 100644 --- a/src/common/config/config.c +++ b/src/common/config/config.c @@ -1222,11 +1222,12 @@ int create_session(const char *name, /* network destination */ if (live_timer_interval && live_timer_interval != UINT64_MAX) { - const char *url = output.control_uri ? - output.control_uri : output.data_uri; - - /* URL has to be provided, even if we'll overwrite it after. */ - ret = lttng_create_session_live(name, url, live_timer_interval); + /* + * URLs are provided for sure since the test above make sure that + * with a live timer the data and control URIs are provided. So, + * NULL is passed here and will be set right after. + */ + ret = lttng_create_session_live(name, NULL, live_timer_interval); } else { ret = lttng_create_session(name, NULL); } @@ -2341,7 +2342,14 @@ int load_session_from_path(const char *path, const char *session_name, directory = opendir(path); if (!directory) { - if (errno != ENOTDIR) { + switch (errno) { + case ENOTDIR: + /* Try the file loading. */ + break; + case ENOENT: + ret = -LTTNG_ERR_LOAD_SESSION_NOENT; + goto end; + default: ret = -LTTNG_ERR_LOAD_IO_FAIL; goto end; } @@ -2456,9 +2464,10 @@ int config_load_session(const char *path, const char *session_name, goto end; } - ret = load_session_from_path(path, NULL, + ret = load_session_from_path(path, session_name, &validation_ctx, 0); - if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) { + if (!ret || (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) { + /* Session found or an error occured */ free(path); goto end; } @@ -2467,9 +2476,10 @@ int config_load_session(const char *path, const char *session_name, } /* Try system session configuration path */ - ret = load_session_from_path(DEFAULT_SESSION_SYSTEM_CONFIGPATH, NULL, - &validation_ctx, 0); - if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) { + ret = load_session_from_path(DEFAULT_SESSION_SYSTEM_CONFIGPATH, + session_name, &validation_ctx, 0); + if (!ret || (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) { + /* Session found or an error occured */ goto end; } } else {