better error setting and reporting in module loading.

* just set error codes if we know the error.
 * debug dlopen() error using EINA_ERROR_PDBG()



SVN revision: 41057
This commit is contained in:
Gustavo Sverzut Barbieri 2009-06-16 14:59:09 +00:00
parent 575b0579cd
commit 32ff1f0aa4
1 changed files with 8 additions and 5 deletions

View File

@ -210,12 +210,14 @@ EAPI Eina_Bool eina_module_load(Eina_Module *m)
if (m->handle) goto loaded;
eina_error_set(EINA_ERROR_WRONG_MODULE);
dl_handle = dlopen(m->file, RTLD_NOW);
if (!dl_handle) return EINA_FALSE;
eina_error_set(EINA_ERROR_MODULE_INIT_FAILED);
if (!dl_handle)
{
EINA_ERROR_PDBG("could not dlopen(\"%s\", RTLD_NOW): %s\n",
m->file, dlerror());
eina_error_set(EINA_ERROR_WRONG_MODULE);
return EINA_FALSE;
}
initcall = dlsym(dl_handle, EINA_MODULE_SYMBOL_INIT);
if ((!initcall) || (!(*initcall)))
@ -223,6 +225,7 @@ EAPI Eina_Bool eina_module_load(Eina_Module *m)
if ((*initcall)() == EINA_TRUE)
goto ok;
eina_error_set(EINA_ERROR_MODULE_INIT_FAILED);
dlclose(dl_handle);
return EINA_FALSE;
ok: