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;
}
/* 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 {