diff options
author | Miguel de Icaza <miguel@gnome.org> | 2006-10-22 01:56:18 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2006-10-22 01:56:18 +0400 |
commit | 618858f5ba104e0cd3e5a1aa276efb71fa50765c (patch) | |
tree | d23804b4807ecc989e00ffc267649770572965cc /eglib | |
parent | f6b278ad7e9b89b4609e51fbf4bdfba62699037c (diff) |
2006-10-21 Miguel de Icaza <miguel@novell.com>
* src/gmodule.c (g_module_open): Actually return NULL if we fail
to load the module (was hiding the real bug in the pinvoke tests).
(g_module_build_path): Do not prepend "lib" if the "lib" is part
of the call.
svn path=/trunk/mono/; revision=66861
Diffstat (limited to 'eglib')
-rw-r--r-- | eglib/ChangeLog | 6 | ||||
-rw-r--r-- | eglib/src/gmodule.c | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/eglib/ChangeLog b/eglib/ChangeLog index f3cce8fb37a..c417abd8490 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,5 +1,11 @@ 2006-10-21 Miguel de Icaza <miguel@novell.com> + * src/gmodule.c (g_module_open): Actually return NULL if we fail + to load the module (was hiding the real bug in the pinvoke tests). + + (g_module_build_path): Do not prepend "lib" if the "lib" is part + of the call. + * src/gstr.c (g_strsplit): this routine has some non-expected behavior, if the string begins with the delimiter, it will return an empty first string, unlike strtok diff --git a/eglib/src/gmodule.c b/eglib/src/gmodule.c index ebd45a7e696..bd02db0f854 100644 --- a/eglib/src/gmodule.c +++ b/eglib/src/gmodule.c @@ -46,18 +46,21 @@ g_module_open (const gchar *file, GModuleFlags flags) { int f = 0; GModule *module; - + void *handle; + flags &= G_MODULE_BIND_MASK; if ((flags & G_MODULE_BIND_LAZY) != 0) f |= RTLD_LAZY; if ((flags & G_MODULE_BIND_LOCAL) != 0) f |= RTLD_LOCAL; - module = g_malloc (sizeof (GModule)); - if (module == NULL) + handle = dlopen (file, f); + if (handle == NULL) return NULL; - - module->handle = dlopen (file, f); + + module = g_new (GModule,1); + module->handle = handle; + return module; } @@ -194,10 +197,17 @@ g_module_close (GModule *module) gchar * g_module_build_path (const gchar *directory, const gchar *module_name) { + char *lib_prefix = ""; + if (module_name == NULL) return NULL; - if (directory) - return g_strdup_printf ("%s/" LIBPREFIX "%s" LIBSUFFIX, directory, module_name); - return g_strdup_printf (LIBPREFIX "%s" LIBSUFFIX, module_name); + if (strncmp (module_name, "lib", 3) != 0) + lib_prefix = LIBPREFIX; + + if (directory && *directory){ + + return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name); + } + return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name); } |