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.9.0-rc1~236 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=6c66fa0f1ee65b19911b76e34158ba933cb5d190 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/session-config.c b/src/common/config/session-config.c index 743b51438..01b6d9c0e 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -2837,8 +2838,8 @@ end: } } - if (!session_found) { - ret = -LTTNG_ERR_LOAD_SESSION_NOENT; + if (session_found) { + ret = 0; } return ret; @@ -2883,6 +2884,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 }; @@ -2941,6 +2943,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; } } @@ -2963,6 +2966,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); @@ -2995,5 +3001,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; }