Fix: lib: handle BT_FUNC_STATUS_NOT_FOUND in bt_plugin_so_create_all_from_sections
[babeltrace.git] / src / lib / plugin / plugin-so.c
index a4622c38f740bd2a97782ac9ffc11f92ed958ae5..698d03d0a0acb61ab667bcddcc6fb8b0a6d83697 100644 (file)
@@ -734,6 +734,12 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = init_status;
                                goto end;
                        } else {
+                               /*
+                                * Since we don't return an error,
+                                * there's no way to communicate this
+                                * error to the caller.
+                                */
+                               bt_current_thread_clear_error();
                                BT_LIB_LOGW(
                                        "User's plugin initialization function failed: "
                                        "status=%s",
@@ -1335,6 +1341,12 @@ int bt_plugin_so_create_all_from_sections(
                        /* Add to plugin set */
                        bt_plugin_set_add_plugin(*plugin_set_out, plugin);
                        BT_OBJECT_PUT_REF_AND_RESET(plugin);
+               } else if (status == BT_FUNC_STATUS_NOT_FOUND) {
+                       /*
+                        * There was an error initializing the plugin,
+                        * but `fail_on_load_error` is false.
+                        */
+                       BT_OBJECT_PUT_REF_AND_RESET(plugin);
                } else if (status < 0) {
                        /*
                         * bt_plugin_so_init() handles
This page took 0.023638 seconds and 4 git commands to generate.