Rationalize plugin symbol error reporting 85/11085/2
authorDave Barach <dave@barachs.net>
Mon, 12 Mar 2018 21:38:31 +0000 (17:38 -0400)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 13 Mar 2018 01:35:23 +0000 (01:35 +0000)
Change-Id: I64f2b2007f30fc1c6bd2990ba0d7ccbcd43cdb38
Signed-off-by: Dave Barach <dave@barachs.net>
src/vat/plugin.c
src/vlib/unix/plugin.c
src/vpp/api/plugin.c

index 20de8c5..b94c4fc 100644 (file)
@@ -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;
 
index 058afcf..a1df3b2 100644 (file)
@@ -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;
index e8b1341..95bdbe6 100644 (file)
@@ -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;