]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_dl_load_cache_lookup): Favour exact matching of version function
authorUlrich Drepper <drepper@redhat.com>
Sat, 25 Oct 1997 01:59:59 +0000 (01:59 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 25 Oct 1997 01:59:59 +0000 (01:59 +0000)
if both the general (1) and glibc-specific (3) entry are present.

sysdeps/generic/dl-cache.c

index b3c46ff6b2a5808fdf261a2f88a88a92b16774a8..53980a7a5e7a1a992530c620164a63a519eac87d 100644 (file)
@@ -53,10 +53,7 @@ _dl_load_cache_lookup (const char *name)
   static struct cache_file *cache;
   static size_t cachesize;
   unsigned int i;
-
-  if (cache == (void *) -1)
-    /* Previously looked for the cache file and didn't find it.  */
-    return NULL;
+  const char *best;
 
   if (cache == NULL)
     {
@@ -76,6 +73,11 @@ _dl_load_cache_lookup (const char *name)
        }
     }
 
+  if (cache == (void *) -1)
+    /* Previously looked for the cache file and didn't find it.  */
+    return NULL;
+
+  best = NULL;
   for (i = 0; i < cache->nlibs; ++i)
     if ((cache->libs[i].flags == 1 ||
         cache->libs[i].flags == 3) && /* ELF library entry.  */
@@ -85,7 +87,14 @@ _dl_load_cache_lookup (const char *name)
        /* Does the name match?  */
        ! strcmp (name, ((const char *) &cache->libs[cache->nlibs] +
                         cache->libs[i].key)))
-      return (const char *) &cache->libs[cache->nlibs] + cache->libs[i].value;
+      {
+       best = ((const char *) &cache->libs[cache->nlibs]
+               + cache->libs[i].value);
 
-  return NULL;
+       if (cache->libs[i].flags == 3)
+         /* We've found an exact match for the shared object and no
+            general `ELF' release.  Stop searching.  */
+         break;
+      }
+  return best;
 }