From: Jérémie Galarneau Date: Mon, 16 May 2016 16:10:19 +0000 (-0400) Subject: Fix: loading a session prints an error message but the load is successful X-Git-Tag: v2.6.3~57 X-Git-Url: https://git.liburcu.org/?a=commitdiff_plain;h=7d8a79978bd8d897fe7bb68b6a139bbff6662b00;p=lttng-tools.git Fix: loading a session prints an error message but the load is successful Fixes #1013 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/config/config.c b/src/common/config/config.c index dca765b0f..21d95ad51 100644 --- a/src/common/config/config.c +++ b/src/common/config/config.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -2594,8 +2595,8 @@ end: } } - if (!session_found) { - ret = -LTTNG_ERR_LOAD_SESSION_NOENT; + if (session_found) { + ret = 0; } return ret; @@ -2640,6 +2641,7 @@ int config_load_session(const char *path, const char *session_name, int override, unsigned int autoload) { int ret; + bool session_loaded = false; const char *path_ptr = NULL; struct session_config_validation_ctx validation_ctx = { 0 }; @@ -2698,6 +2700,7 @@ int config_load_session(const char *path, const char *session_name, * Continue even if the session was found since we have to try * the system wide sessions. */ + session_loaded = true; } } @@ -2720,6 +2723,9 @@ int config_load_session(const char *path, const char *session_name, if (path_ptr) { ret = load_session_from_path(path_ptr, session_name, &validation_ctx, override); + if (!ret) { + session_loaded = true; + } } } else { ret = access(path, F_OK); @@ -2752,5 +2758,10 @@ end: */ ret = 0; } + + if (session_loaded && ret == -LTTNG_ERR_LOAD_SESSION_NOENT) { + /* A matching session was found in one of the search paths. */ + ret = 0; + } return ret; }