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.7.3~68 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=5f75dfa0dea895564aca2709b9fac623e1264cd8;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 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; }