From 5f75dfa0dea895564aca2709b9fac623e1264cd8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 16 May 2016 12:10:19 -0400 Subject: [PATCH] Fix: loading a session prints an error message but the load is successful MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes #1013 Signed-off-by: Jérémie Galarneau --- src/common/config/config.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/config/config.c b/src/common/config/config.c index 48dc0b034..a4d4f04f5 100644 --- a/src/common/config/config.c +++ b/src/common/config/config.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -2743,8 +2744,8 @@ end: } } - if (!session_found) { - ret = -LTTNG_ERR_LOAD_SESSION_NOENT; + if (session_found) { + ret = 0; } return ret; @@ -2789,6 +2790,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 }; @@ -2847,6 +2849,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; } } @@ -2869,6 +2872,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); @@ -2901,5 +2907,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; } -- 2.34.1