--- kdelibs-2.2.1/libltdl/ltdl.c	Tue Sep  4 18:08:19 2001
+++ kdelibs-2.2/libltdl/ltdl.c	Mon Jul 30 17:11:47 2001
@@ -2301,8 +2301,6 @@
     if (handle != newhandle)
       {
 	unload_deplibs (handle);
-      } else {
-	handle->info.filename = strdup( filename );
       }
     }
   else
@@ -2391,6 +2389,7 @@
       return 0;
     }
 
+  /* try "filename.la" */
   tmp = LT_DLMALLOC (char, len+4);
   if (!tmp)
     {
@@ -2398,6 +2397,14 @@
       return 0;
     }
   strcpy (tmp, filename);
+  strcat (tmp, ".la");
+  handle = lt_dlopen (tmp);
+  if (handle)
+    {
+      MUTEX_SETERROR (saved_error);
+      LT_DLFREE (tmp);
+      return handle;
+    }
 
 #ifdef _AIX
   tmp[len] = '\0';
@@ -2419,20 +2426,7 @@
       LT_DLFREE (tmp);
       return handle;
     }
-#endif /* _AIX */
-
-  /* try "filename.la" */
-  strcat (tmp, ".la");
-  handle = lt_dlopen (tmp);
-  if (handle)
-    {
-      MUTEX_SETERROR (saved_error);
-      LT_DLFREE (tmp);
-      return handle;
-    }
-
 
-#ifdef _AIX
   /* versioned shared objects can be in .a's */
   strcat(tmp, ".a");
   handle = lt_dlopen (tmp);
@@ -3324,33 +3318,23 @@
 {
   lt_dlhandle cur;
   const char* la;
-  int         inlen;
 
   cur = handles;
 
   while (cur)
     {
-      if( cur->info.name && name )
+      if( cur->info.name && name &&
+	  !strcmp( cur->info.name, name ) )
         {
-	  if( !strcmp( cur->info.name, name ) )
-            {
-	      if( cur->info.filename )
+	  if( cur->info.filename )
+	    {
+	      la = strrchr( cur->info.filename, '.' );
+	      if( !la || strcmp(la,".la") )
 	        {
-	          la = strrchr( cur->info.filename, '.' );
-	          if( !la || strcmp(la,".la") )
-	            {
-	              return cur;
-	            }
+	          return cur;
 	        }
-            }
-        }
-      if( cur->info.filename && name )
-	{
-	  if( !strcmp( cur->info.filename, name ) )
-	    {
-	      return cur;
 	    }
-	}
+        }
       cur = cur->next;
     }
   return NULL;
