erk, strconcat needs NULL as last arg. make sure we pass module name with
authorTim Janik <timj@gtk.org>
Tue, 29 May 2001 11:05:53 +0000 (11:05 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 29 May 2001 11:05:53 +0000 (11:05 +0000)
Tue May 29 12:57:51 2001  Tim Janik  <timj@gtk.org>

        * gmodule.c (g_module_symbol): erk, strconcat needs NULL as last arg.
        make sure we pass module name with suffix into backend open.

gmodule/ChangeLog
gmodule/gmodule.c

index 7c6d0ae..cab25ea 100644 (file)
@@ -1,3 +1,8 @@
+Tue May 29 12:57:51 2001  Tim Janik  <timj@gtk.org>
+
+       * gmodule.c (g_module_symbol): erk, strconcat needs NULL as last arg.
+       make sure we pass module name with suffix into backend open.
+
 Mon May 28 20:19:25 2001  Tim Janik  <timj@gtk.org>
 
        * gmodule.c (g_module_open): as a last resort, if we can't access()
index ba2d13c..7f7cf28 100644 (file)
@@ -346,7 +346,7 @@ g_module_open (const gchar    *file_name,
   /* try completing by appending libtool suffix */
   if (!name)
     {
-      name = g_strconcat (file_name, ".la");
+      name = g_strconcat (file_name, ".la", NULL);
       if (!g_file_test (name, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
        {
          g_free (name);
@@ -357,7 +357,16 @@ g_module_open (const gchar    *file_name,
    * it via library paths
    */
   if (!name)
-    name = g_strdup (file_name);
+    {
+      gchar *dot = strrchr (file_name, '.');
+      gchar *slash = strrchr (file_name, G_DIR_SEPARATOR);
+      
+      /* make sure the name has a suffix */
+      if (!dot || dot < slash)
+       name = g_strconcat (file_name, "." G_MODULE_SUFFIX, NULL);
+      else
+       name = g_strdup (file_name);
+    }
 
   /* ok, try loading the module */
   if (name)