From f7683c0423277dec3ec939cf33c3044658ee48a5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 24 Oct 2001 22:24:14 +0000 Subject: [PATCH] Added a bit better error reporting. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1911 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/modules-load.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/modules-load.c b/src/core/modules-load.c index 17f50e55..04342a1b 100644 --- a/src/core/modules-load.c +++ b/src/core/modules-load.c @@ -101,7 +101,7 @@ static char *module_get_sub(const char *name, const char *root) return g_strdup(name); } -static GModule *module_open(const char *name) +static GModule *module_open(const char *name, int *found) { struct stat statbuf; GModule *module; @@ -119,6 +119,7 @@ static GModule *module_open(const char *name) if (stat(path, &statbuf) == 0) { module = g_module_open(path, (GModuleFlags) 0); g_free(path); + *found = TRUE; return module; } @@ -127,6 +128,7 @@ static GModule *module_open(const char *name) path = g_module_build_path(MODULEDIR, name); } + *found = stat(path, &statbuf) == 0; module = g_module_open(path, (GModuleFlags) 0); g_free(path); return module; @@ -161,13 +163,13 @@ static int module_load_name(const char *path, const char *rootmodule, char *initfunc, *deinitfunc; int found; - gmodule = module_open(path); + gmodule = module_open(path, &found); if (gmodule == NULL) { - if (!silent) { + if (!silent || found) { module_error(MODULE_ERROR_LOAD, g_module_error(), rootmodule, submodule); } - return -1; + return found ? 0 : -1; } /* get the module's init() and deinit() functions */