mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Added a bit better error reporting.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1911 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
bdf5bf9785
commit
f7683c0423
@ -101,7 +101,7 @@ static char *module_get_sub(const char *name, const char *root)
|
|||||||
return g_strdup(name);
|
return g_strdup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GModule *module_open(const char *name)
|
static GModule *module_open(const char *name, int *found)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
GModule *module;
|
GModule *module;
|
||||||
@ -119,6 +119,7 @@ static GModule *module_open(const char *name)
|
|||||||
if (stat(path, &statbuf) == 0) {
|
if (stat(path, &statbuf) == 0) {
|
||||||
module = g_module_open(path, (GModuleFlags) 0);
|
module = g_module_open(path, (GModuleFlags) 0);
|
||||||
g_free(path);
|
g_free(path);
|
||||||
|
*found = TRUE;
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +128,7 @@ static GModule *module_open(const char *name)
|
|||||||
path = g_module_build_path(MODULEDIR, name);
|
path = g_module_build_path(MODULEDIR, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*found = stat(path, &statbuf) == 0;
|
||||||
module = g_module_open(path, (GModuleFlags) 0);
|
module = g_module_open(path, (GModuleFlags) 0);
|
||||||
g_free(path);
|
g_free(path);
|
||||||
return module;
|
return module;
|
||||||
@ -161,13 +163,13 @@ static int module_load_name(const char *path, const char *rootmodule,
|
|||||||
char *initfunc, *deinitfunc;
|
char *initfunc, *deinitfunc;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
gmodule = module_open(path);
|
gmodule = module_open(path, &found);
|
||||||
if (gmodule == NULL) {
|
if (gmodule == NULL) {
|
||||||
if (!silent) {
|
if (!silent || found) {
|
||||||
module_error(MODULE_ERROR_LOAD, g_module_error(),
|
module_error(MODULE_ERROR_LOAD, g_module_error(),
|
||||||
rootmodule, submodule);
|
rootmodule, submodule);
|
||||||
}
|
}
|
||||||
return -1;
|
return found ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the module's init() and deinit() functions */
|
/* get the module's init() and deinit() functions */
|
||||||
|
Loading…
Reference in New Issue
Block a user