From: Ulrich Drepper Date: Sat, 25 Oct 1997 01:59:59 +0000 (+0000) Subject: (_dl_load_cache_lookup): Favour exact matching of version function X-Git-Tag: cvs/glibc-2_0_6-pre2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158944e642bf92f783f0fe84df0d86466959ac6e;p=thirdparty%2Fglibc.git (_dl_load_cache_lookup): Favour exact matching of version function if both the general (1) and glibc-specific (3) entry are present. --- diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index b3c46ff6b2a..53980a7a5e7 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -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; }