summary refs log tree commit diff
path: root/elf/ldconfig.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-28 08:33:57 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-28 08:33:57 +0200
commit6bf789d69e6be48419094ca98f064e00297a27d5 (patch)
treeb10799a92799ff4f5f79a1ac77f96b87dcfc293c /elf/ldconfig.c
parentb89d5de2508215ef3131db7bed76ac50b3f4c205 (diff)
downloadglibc-6bf789d69e6be48419094ca98f064e00297a27d5.tar.gz
glibc-6bf789d69e6be48419094ca98f064e00297a27d5.tar.xz
glibc-6bf789d69e6be48419094ca98f064e00297a27d5.zip
elf: Generalize name-based DSO recognition in ldconfig
This introduces <dl-is_dso.h> and the _dl_is_dso function.  A
test ensures that the official names of libc.so, ld.so, and their
versioned names are recognized.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf/ldconfig.c')
-rw-r--r--elf/ldconfig.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 96bf7700b2..1037e8d0cf 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -43,6 +43,7 @@
 #include <ldconfig.h>
 #include <dl-cache.h>
 #include <dl-hwcaps.h>
+#include <dl-is_dso.h>
 
 #include <dl-procinfo.h>
 
@@ -842,9 +843,7 @@ search_dir (const struct dir_entry *entry)
 	 subdirectory (if not already processing a glibc-hwcaps
 	 subdirectory)?  The dynamic linker is also considered as
 	 shared library.  */
-      if (((strncmp (direntry->d_name, "lib", 3) != 0
-	    && strncmp (direntry->d_name, "ld-", 3) != 0)
-	   || strstr (direntry->d_name, ".so") == NULL)
+      if (!_dl_is_dso (direntry->d_name)
 	  && (direntry->d_type == DT_REG
 	      || (entry->hwcaps == NULL
 		  && !is_hwcap_platform (direntry->d_name))))