Exit if plugin load attempt fail 33/6433/2
authorDamjan Marion <damarion@cisco.com>
Tue, 25 Apr 2017 19:07:52 +0000 (21:07 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 26 Apr 2017 00:11:35 +0000 (00:11 +0000)
This happens mainly if plugin contains unresolved symbol.
Such situation typically leads on crash a bit later so it is better
to exit immediatelly and display meaningful error message.

Change-Id: I4abd9a9089a4863400bf609e8d3fd7cebab92913
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/vlib/unix/plugin.c

index 9b341cc..c2741aa 100644 (file)
@@ -137,15 +137,11 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi, int from_early_init)
 
   handle = dlopen ((char *) pi->filename, RTLD_LAZY);
 
-  /*
-   * Note: this can happen if the plugin has an undefined symbol reference,
-   * so print a warning. Otherwise, the poor slob won't know what happened.
-   * Ask me how I know that...
-   */
   if (handle == 0)
     {
       clib_warning ("%s", dlerror ());
-      return -1;
+      clib_warning ("Failed to load plugin '%s'", pi->name);
+      os_exit (1);
     }
 
   pi->handle = handle;