about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/ldconfig.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index bb9a3d4c83..1acacb4225 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -787,11 +787,18 @@ search_dir (const struct dir_entry *entry)
       if (real_name != real_file_name)
 	free (real_name);
 
-      /* Links will just point to itself.  */
+      /* A link may just point to itself.  */
       if (is_link)
 	{
-	  free (soname);
-	  soname = xstrdup (direntry->d_name);
+	  /* If the path the link points to isn't its soname, we treat
+	     it as a normal file.  */
+	  if (strcmp (basename (real_name), soname) != 0)
+	    is_link = 0;
+	  else
+	    {
+	      free (soname);
+	      soname = xstrdup (direntry->d_name);
+	    }
 	}
 
       if (flag == FLAG_ELF