Pierre Ossman wrote:
Bob Friesenhahn wrote:

What happens if the path specified by 'base_name' does not include a '.'? Does it crash?


Good point. It should be surrounded by an 'if (ext)'.

Note that the code in development libtool is quite different than the ltdl.c you used.


I'm using 1.5.20 here. That was the newest version when we did the upgrade a couple of weeks ago. I'm trying to be a user, not a developer so running a CVS version wasn't really planned. ;)


New version of the patch (against branch-1-5). HEAD seems to do the right thing as-is.

--
Pierre Ossman                Telephone: +46-13-21 46 00
Cendio AB                    Web: http://www.cendio.com
Index: libltdl/ltdl.c
===================================================================
RCS file: /sources/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.21
diff -u -r1.174.2.21 ltdl.c
--- libltdl/ltdl.c	2 Jan 2006 08:34:03 -0000	1.174.2.21
+++ libltdl/ltdl.c	4 Jan 2006 09:42:10 -0000
@@ -3126,6 +3126,35 @@
 
   /* Check whether we are opening a libtool module (.la extension).  */
   ext = strrchr (base_name, '.');
+
+  if (ext)
+    {
+      /* extract the module name from the file name */
+      name = LT_EMALLOC (char, ext - base_name + 1);
+      if (!name)
+        {
+          ++errors;
+          goto cleanup;
+        }
+
+      /* canonicalize the module name */
+      {
+        size_t i;
+        for (i = 0; i < ext - base_name; ++i)
+          {
+            if (isalnum ((int)(base_name[i])))
+              {
+                name[i] = base_name[i];
+              }
+            else
+              {
+                name[i] = '_';
+              }
+          }
+        name[ext - base_name] = LT_EOS_CHAR;
+      }
+    }
+
   if (ext && strcmp (ext, archive_ext) == 0)
     {
       /* this seems to be a libtool module */
@@ -3142,30 +3171,6 @@
 	 of libtool */
       int	installed = 1;
 
-      /* extract the module name from the file name */
-      name = LT_EMALLOC (char, ext - base_name + 1);
-      if (!name)
-	{
-	  ++errors;
-	  goto cleanup;
-	}
-
-      /* canonicalize the module name */
-      {
-        size_t i;
-        for (i = 0; i < ext - base_name; ++i)
-	  {
-	    if (isalnum ((int)(base_name[i])))
-	      {
-	        name[i] = base_name[i];
-	      }
-	    else
-	      {
-	        name[i] = '_';
-	      }
-	  }
-        name[ext - base_name] = LT_EOS_CHAR;
-      }
 
       /* Now try to open the .la file.  If there is no directory name
          component, try to find it first in user_search_path and then other
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to