From 3464c860650c5d8cc8abf11c7d2faa074105b8d6 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Mon, 12 Mar 2018 17:38:31 -0400 Subject: [PATCH] Rationalize plugin symbol error reporting Change-Id: I64f2b2007f30fc1c6bd2990ba0d7ccbcd43cdb38 Signed-off-by: Dave Barach --- src/vat/plugin.c | 9 +++++++-- src/vlib/unix/plugin.c | 2 +- src/vpp/api/plugin.c | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/vat/plugin.c b/src/vat/plugin.c index 20de8c50b6f..b94c4fc30d0 100644 --- a/src/vat/plugin.c +++ b/src/vat/plugin.c @@ -40,14 +40,19 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi) if (handle == 0) { clib_warning ("%s", dlerror ()); - return -1; + return 0; } pi->handle = handle; register_handle = dlsym (pi->handle, "vat_plugin_register"); if (register_handle == 0) - return 0; + { + clib_warning ("%s: symbol vat_plugin_register not found", pi->name); + dlclose (handle); + return 0; + } + fp = register_handle; diff --git a/src/vlib/unix/plugin.c b/src/vlib/unix/plugin.c index 058afcfcae0..a1df3b24b66 100644 --- a/src/vlib/unix/plugin.c +++ b/src/vlib/unix/plugin.c @@ -141,7 +141,7 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi, int from_early_init) { clib_warning ("%s", dlerror ()); clib_warning ("Failed to load plugin '%s'", pi->name); - os_exit (1); + goto error; } pi->handle = handle; diff --git a/src/vpp/api/plugin.c b/src/vpp/api/plugin.c index e8b134173d8..95bdbe6cd7e 100644 --- a/src/vpp/api/plugin.c +++ b/src/vpp/api/plugin.c @@ -40,14 +40,18 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi) if (handle == 0) { clib_warning ("%s", dlerror ()); - return -1; + return 0; } pi->handle = handle; register_handle = dlsym (pi->handle, "vat_plugin_register"); if (register_handle == 0) - return 0; + { + clib_warning ("%s: symbol vat_plugin_register not found", pi->name); + dlclose (handle); + return 0; + } fp = register_handle; -- 2.16.6