Skip to content

Commit 643514a

Browse files
committed
[core] recent g_module_open handles lib prefix and suffixes better; try that first
Change-Id: Ieecd1234e5cc81a11e43172d4563d43bca6658be
1 parent 7c2d19e commit 643514a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/common/module.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,22 @@ liModule* li_module_load(liModules *mods, const gchar* name, GError **err) {
7070
mod->name = g_string_new(name);
7171
mod->refcount = 1;
7272

73-
mod->path = g_module_build_path(mods->module_dir, name);
73+
mod->path = g_strconcat(mods->module_dir, G_DIR_SEPARATOR_S, name, NULL);
7474
mod->module = g_module_open(mod->path, G_MODULE_BIND_LAZY);
7575

7676
if (!mod->module) {
7777
if (err) g_set_error(err, LI_MODULES_ERROR, 1, "%s", g_module_error());
78-
g_string_free(mod->name, TRUE);
7978
g_free(mod->path);
80-
g_slice_free(liModule, mod);
81-
return NULL;
79+
80+
mod->path = g_module_build_path(mods->module_dir, name);
81+
mod->module = g_module_open(mod->path, G_MODULE_BIND_LAZY);
82+
83+
if (!mod->module) {
84+
g_string_free(mod->name, TRUE);
85+
g_free(mod->path);
86+
g_slice_free(liModule, mod);
87+
return NULL;
88+
}
8289
}
8390

8491
/* temporary strings for mod_xyz_init and mod_xyz_free */

0 commit comments

Comments
 (0)