Handle valid symbols that are NULL correctly. (#385388, Felix Kater)

2006-12-13  Matthias Clasen  <mclasen@redhat.com>

        * gmodule.c (g_module_open):
        * gmodule-dl.c (_g_module_symbol): Handle valid symbols
        that are NULL correctly.  (#385388, Felix Kater)
This commit is contained in:
Matthias Clasen
2006-12-13 15:41:22 +00:00
committed by Matthias Clasen
parent caecf2dda0
commit ea1512221b
5 changed files with 40 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ _g_module_open (const gchar *file_name,
gpointer handle;
handle = dlopen (file_name,
(bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
(bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
if (!handle)
g_module_set_error (fetch_dlerror (TRUE));
@@ -140,10 +140,13 @@ _g_module_symbol (gpointer handle,
const gchar *symbol_name)
{
gpointer p;
gchar *msg;
fetch_dlerror (FALSE);
p = dlsym (handle, symbol_name);
if (!p)
g_module_set_error (fetch_dlerror (FALSE));
msg = fetch_dlerror (FALSE);
if (msg)
g_module_set_error (msg);
return p;
}