[lttng-dev] [PATCH lttng-tools] Fix: Succesful session load might still report an error

Jérémie Galarneau jeremie.galarneau at efficios.com
Wed Mar 19 11:29:18 EDT 2014


This ensures that the load command reports a successful load when
the session is found in the user's home session configuration
directory and not in the system-wide session configuration directory.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
---
 src/common/config/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/common/config/config.c b/src/common/config/config.c
index 7c6c49b..e74e20f 100644
--- a/src/common/config/config.c
+++ b/src/common/config/config.c
@@ -2458,7 +2458,8 @@ int config_load_session(const char *path, const char *session_name,
 
 			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;
 			}
@@ -2469,7 +2470,8 @@ 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,
 			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 */
 			goto end;
 		}
 	} else {
-- 
1.9.0




More information about the lttng-dev mailing list