Subject: Re: reducing library searches in ld.elf_so
To: Charles Hannum <abuse@spamalicious.com>
From: Bang Jun-Young <junyoung@mogua.com>
List: current-users
Date: 09/28/2002 12:29:46
On Sat, Sep 28, 2002 at 12:16:18PM +0900, Bang Jun-Young wrote:
> + if (!strncmp(name, sp->sp_path + sp->sp_pathlen - namelen,
> + namelen) && !strncmp(dir, sp->sp_path, sp->sp_pathlen -
Euch. This is the correct one:
Index: search.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/ld.elf_so/search.c,v
retrieving revision 1.13
diff -u -r1.13 search.c
--- search.c 2002/09/24 12:52:20 1.13
+++ search.c 2002/09/28 03:25:45
@@ -55,6 +55,8 @@
/*
* Data declarations.
*/
+Search_Path *_rtld_invalid_paths;
+
static Obj_Entry *_rtld_search_library_path __P((const char *, size_t,
const char *, size_t, int));
@@ -68,6 +70,16 @@
{
char *pathname;
Obj_Entry *obj;
+ Search_Path *sp;
+
+ for (sp = _rtld_invalid_paths; sp != NULL; sp = sp->sp_next) {
+ /* Compare names first, then dirpaths. */
+ if (!strncmp(name, sp->sp_path + sp->sp_pathlen - namelen,
+ namelen) && !strncmp(dir, sp->sp_path, dirlen)) {
+ dbg((" \"%s/%s\" marked invalid", dir, name));
+ return NULL;
+ }
+ }
pathname = xmalloc(dirlen + 1 + namelen + 1);
(void)strncpy(pathname, dir, dirlen);
@@ -76,8 +88,10 @@
dbg((" Trying \"%s\"", pathname));
obj = _rtld_load_object(pathname, mode);
- if (obj == NULL)
+ if (obj == NULL) {
+ _rtld_add_paths(&_rtld_invalid_paths, pathname);
free(pathname);
+ }
return obj;
}
Jun-Young
--
Bang Jun-Young <junyoung@mogua.com>