config: fix typo in error message
[lttng-tools.git] / src / common / config / session-config.c
index 595e743b45de0cc3de1e7a82de8b1a0d635e7bf7..799919d6a8a2e224551c1b4db783431237fc6ac3 100644 (file)
@@ -177,7 +177,7 @@ const char * const config_loglevel_type_single = "SINGLE";
 const char * const config_event_type_all = "ALL";
 const char * const config_event_type_tracepoint = "TRACEPOINT";
 const char * const config_event_type_probe = "PROBE";
-const char * const config_event_type_userspace_probe = "USERSPACE_PROBE";
+LTTNG_HIDDEN const char * const config_event_type_userspace_probe = "USERSPACE_PROBE";
 const char * const config_event_type_function = "FUNCTION";
 const char * const config_event_type_function_entry = "FUNCTION_ENTRY";
 const char * const config_event_type_noop = "NOOP";
@@ -250,7 +250,7 @@ int config_get_section_entries(const char *override_path, const char *section,
                config_entry_handler_cb handler, void *user_data)
 {
        int ret = 0;
-       char *path;
+       const char *path;
        FILE *config_file = NULL;
        struct handler_filter_args filter = { section, handler, user_data };
 
@@ -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;
        }
@@ -1633,6 +1633,7 @@ process_userspace_probe_tracepoint_attribute_node(
                                lttng_userspace_probe_location_tracepoint_create(
                                                binary_path, provider_name,
                                                probe_name, lookup_method);
+                       lookup_method = NULL;
                        goto error;
                }
        }
@@ -3308,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:
@@ -3443,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 '/'.
@@ -3531,7 +3563,7 @@ int config_load_session(const char *path, const char *session_name,
        }
 
        if (!path) {
-               char *home_path;
+               const char *home_path;
                const char *sys_path;
 
                /* Try home path */
This page took 0.024209 seconds and 4 git commands to generate.