From ed2d5f0075cc5c96ecc2edc0b58d29739f89e5cb Mon Sep 17 00:00:00 2001 From: barbieri Date: Tue, 16 Jun 2009 14:59:09 +0000 Subject: [PATCH] better error setting and reporting in module loading. * just set error codes if we know the error. * debug dlopen() error using EINA_ERROR_PDBG() git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@41057 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eina_module.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/eina_module.c b/src/lib/eina_module.c index 6abd6ed..c39aa34 100644 --- a/src/lib/eina_module.c +++ b/src/lib/eina_module.c @@ -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: -- 2.7.4