eina_module: Raise dlopen() error messages to WRN when file exists
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 13 Jul 2015 05:08:08 +0000 (14:08 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 16 Jul 2015 10:50:38 +0000 (19:50 +0900)
Failing to load a module that does not exist is indeed not an error,
but failing to load a module that exists on disk happened probably
because of an error like "symbol not found".

Considering eina_module is most likely used by EFL itself, I believe
an internal linking failure is a warning worth reporting.

src/lib/eina/eina_module.c

index 7c421e3..1c2075a 100644 (file)
@@ -330,8 +330,13 @@ EAPI Eina_Bool eina_module_load(Eina_Module *m)
 
    if (!dl_handle)
      {
-        DBG("could not dlopen(\"%s\", %s): %s", m->file, dlerror(),
-            (flag == RTLD_NOW) ? "RTLD_NOW" : "RTLD_LAZY");
+        struct stat st;
+        if (!stat(m->file, &st))
+          WRN("could not dlopen(\"%s\", %s): %s", m->file, dlerror(),
+              (flag == RTLD_NOW) ? "RTLD_NOW" : "RTLD_LAZY");
+        else
+          DBG("could not dlopen(\"%s\", %s): %s", m->file, dlerror(),
+              (flag == RTLD_NOW) ? "RTLD_NOW" : "RTLD_LAZY");
         return EINA_FALSE;
      }