diff --git a/gio/gio-querymodules.c b/gio/gio-querymodules.c index eb5094f4d..cbeb9758e 100644 --- a/gio/gio-querymodules.c +++ b/gio/gio-querymodules.c @@ -81,7 +81,7 @@ query_dir (const char *dirname) continue; path = g_build_filename (dirname, name, NULL); - module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + module = g_module_open_full (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL, &error); g_free (path); if (module) @@ -119,6 +119,12 @@ query_dir (const char *dirname) g_module_close (module); } + else + { + g_debug ("Failed to open module %s: %s", name, error->message); + } + + g_clear_error (&error); } g_dir_close (dir); diff --git a/gio/giomodule.c b/gio/giomodule.c index d3b5e482a..c1d451b5c 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -342,6 +342,7 @@ static gboolean g_io_module_load_module (GTypeModule *gmodule) { GIOModule *module = G_IO_MODULE (gmodule); + GError *error = NULL; if (!module->filename) { @@ -349,11 +350,12 @@ g_io_module_load_module (GTypeModule *gmodule) return FALSE; } - module->library = g_module_open (module->filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + module->library = g_module_open_full (module->filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL, &error); if (!module->library) { - g_printerr ("%s\n", g_module_error ()); + g_printerr ("%s\n", error->message); + g_clear_error (&error); return FALSE; } diff --git a/tests/module-test.c b/tests/module-test.c index e0e6423f6..62473d29d 100644 --- a/tests/module-test.c +++ b/tests/module-test.c @@ -84,6 +84,7 @@ main (int argc, gchar *plugin_a, *plugin_b; SimpleFunc f_a, f_b, f_self; GModuleFunc gmod_f; + GError *error = NULL; g_test_init (&argc, &argv, NULL); @@ -95,18 +96,21 @@ main (int argc, /* module handles */ - module_self = g_module_open (NULL, G_MODULE_BIND_LAZY); + module_self = g_module_open_full (NULL, G_MODULE_BIND_LAZY, &error); + g_assert_no_error (error); if (!module_self) g_error ("error: %s", g_module_error ()); if (!g_module_symbol (module_self, "g_module_close", (gpointer *) &f_self)) g_error ("error: %s", g_module_error ()); - module_a = g_module_open (plugin_a, G_MODULE_BIND_LAZY); + module_a = g_module_open_full (plugin_a, G_MODULE_BIND_LAZY, &error); + g_assert_no_error (error); if (!module_a) g_error ("error: %s", g_module_error ()); - module_b = g_module_open (plugin_b, G_MODULE_BIND_LAZY); + module_b = g_module_open_full (plugin_b, G_MODULE_BIND_LAZY, &error); + g_assert_no_error (error); if (!module_b) g_error ("error: %s", g_module_error ());