X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fsession-config.c;h=799919d6a8a2e224551c1b4db783431237fc6ac3;hb=73bbfeee351ab85e3ce37d785c05b9e62e0b7b53;hp=b1fa992fe0f65c02f922ea99d4d6d3c632d23b1c;hpb=eae9fe4ac107bb9b0b0bcf2e4777b2d95a5ccad6;p=lttng-tools.git diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index b1fa992fe..799919d6a 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -815,7 +815,7 @@ int parse_bool(xmlChar *str, int *val) } else if (!strcmp((const char *) str, config_xml_false)) { *val = 0; } else { - WARN("Invalid boolean value encoutered (%s).", + WARN("Invalid boolean value encountered (%s).", (const char *) str); ret = -1; } @@ -3309,10 +3309,24 @@ int load_session_from_file(const char *path, const char *session_name, xmlNextElementSibling(session_node)) { ret = process_session_node(session_node, session_name, overwrite, overrides); - if (session_name && ret == 0) { - /* Target session found and loaded */ - session_found = 1; - break; + if (!session_name && ret) { + /* Loading error occurred. */ + goto end; + } else if (session_name) { + if (ret == 0) { + /* Target session found and loaded */ + session_found = 1; + break; + } else if (ret == -LTTNG_ERR_NO_SESSION) { + /* + * Ignore this error, we are looking for the + * session. + */ + ret = 0; + } else { + /* Loading error occurred. */ + goto end; + } } } end: @@ -3444,10 +3458,27 @@ int load_session_from_path(const char *path, const char *session_name, ret = load_session_from_file(file_path.data, session_name, validation_ctx, overwrite, overrides); - if (session_name && !ret) { - session_found = 1; - break; + if (!session_name && ret) { + /* Loading error occured. */ + goto end; + } else if (session_name) { + if (ret == 0) { + /* Target session found and loaded */ + session_found = 1; + break; + } else if (ret == + -LTTNG_ERR_LOAD_SESSION_NOENT) { + /* + * Ignore this error, we are looking for + * the session. + */ + ret = 0; + } else { + /* Loading error occured. */ + goto end; + } } + /* * Reset the buffer's size to the location of the * path's trailing '/'.