Skip to content

Commit

Permalink
[core] recent g_module_open handles lib prefix and suffixes better; t…
Browse files Browse the repository at this point in the history
…ry that first

Change-Id: Ieecd1234e5cc81a11e43172d4563d43bca6658be
  • Loading branch information
stbuehler committed Jan 13, 2024
1 parent 7c2d19e commit 643514a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/common/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,22 @@ liModule* li_module_load(liModules *mods, const gchar* name, GError **err) {
mod->name = g_string_new(name);
mod->refcount = 1;

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

if (!mod->module) {
if (err) g_set_error(err, LI_MODULES_ERROR, 1, "%s", g_module_error());
g_string_free(mod->name, TRUE);
g_free(mod->path);
g_slice_free(liModule, mod);
return NULL;

mod->path = g_module_build_path(mods->module_dir, name);
mod->module = g_module_open(mod->path, G_MODULE_BIND_LAZY);

if (!mod->module) {
g_string_free(mod->name, TRUE);
g_free(mod->path);
g_slice_free(liModule, mod);
return NULL;
}
}

/* temporary strings for mod_xyz_init and mod_xyz_free */
Expand Down

0 comments on commit 643514a

Please sign in to comment.