openbsd-ports/devel/glib2/patches/patch-gmodule_gmodule_c
marcm 805f07b12f Update to 2.4.5, new PLIST. Added patches from NetBSD that add support
for "dlopen(NULL, 0) brokenness" (which we have) that manifests itself
in some GNOME apps.
2004-08-08 17:12:55 +00:00

67 lines
1.9 KiB
Plaintext

$OpenBSD: patch-gmodule_gmodule_c,v 1.1 2004/08/08 17:12:55 marcm Exp $
--- gmodule/gmodule.c.orig Sat Feb 21 17:31:24 2004
+++ gmodule/gmodule.c Sun Aug 1 22:38:29 2004
@@ -521,6 +521,24 @@ g_module_error (void)
return g_static_private_get (&module_error_private);
}
+static void
+g_module_symbol_aux (GModule *module,
+ const gchar *symbol_name,
+ gpointer *symbol)
+{
+#ifdef G_MODULE_NEED_USCORE
+ {
+ gchar *name;
+
+ name = g_strconcat ("_", symbol_name, NULL);
+ *symbol = _g_module_symbol (module->handle, name);
+ g_free (name);
+ }
+#else /* !G_MODULE_NEED_USCORE */
+ *symbol = _g_module_symbol (module->handle, symbol_name);
+#endif /* !G_MODULE_NEED_USCORE */
+}
+
gboolean
g_module_symbol (GModule *module,
const gchar *symbol_name,
@@ -538,17 +556,28 @@ g_module_symbol (GModule *module,
g_static_rec_mutex_lock (&g_module_global_lock);
-#ifdef G_MODULE_NEED_USCORE
+#ifdef G_MODULE_BROKEN_DLOPEN_NULL
+ if (module == main_module)
{
- gchar *name;
-
- name = g_strconcat ("_", symbol_name, NULL);
- *symbol = _g_module_symbol (module->handle, name);
- g_free (name);
+ g_module_symbol_aux(module, symbol_name, symbol);
+ if (*symbol == NULL)
+ {
+ for (module = modules; module; module = module->next)
+ {
+ g_module_symbol_aux(module, symbol_name, symbol);
+ if (*symbol != NULL)
+ {
+ g_module_set_error (NULL);
+ break;
}
-#else /* !G_MODULE_NEED_USCORE */
- *symbol = _g_module_symbol (module->handle, symbol_name);
-#endif /* !G_MODULE_NEED_USCORE */
+ }
+ }
+ }
+ else
+ g_module_symbol_aux(module, symbol_name, symbol);
+#else /* !G_MODULE_BROKEN_DLOPEN_NULL */
+ g_module_symbol_aux(module, symbol_name, symbol);
+#endif /* G_MODULE_BROKEN_DLOPEN_NULL */
module_error = g_module_error ();
if (module_error)