From df4cd81882926df08d6ac5b0f56b288b90c19ad9 Mon Sep 17 00:00:00 2001 From: mdodd Date: Sat, 13 Sep 2003 21:43:08 +0000 Subject: Change libmap.c:lm_init() to return a status value; 0 for success (libmap available) and 1 for failure. Assign this return to the global 'libmap_disable' variable in rtld.c. This totally prevents any libmap functions from being called after lm_init() if no config file is present. --- libexec/rtld-elf/libmap.c | 6 +++--- libexec/rtld-elf/libmap.h | 2 +- libexec/rtld-elf/rtld.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libexec') diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index bdb9151..56e04fd 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -41,7 +41,7 @@ static struct lm_list * lmp_init (char *); #define iseol(c) (((c) == '#') || ((c) == '\0') || \ ((c) == '\n') || ((c) == '\r')) -void +int lm_init (void) { FILE *fp; @@ -55,7 +55,7 @@ lm_init (void) TAILQ_INIT(&lmp_head); if ((fp = fopen(_PATH_LIBMAP_CONF, "r")) == NULL) - return; + return (1); p = NULL; while ((cp = fgets(line, MAXPATHLEN + 1, fp)) != NULL) { @@ -128,7 +128,7 @@ lm_init (void) lm_add(p, f, t); } fclose(fp); - return; + return (0); } static void diff --git a/libexec/rtld-elf/libmap.h b/libexec/rtld-elf/libmap.h index 8228ef8..f42df44 100644 --- a/libexec/rtld-elf/libmap.h +++ b/libexec/rtld-elf/libmap.h @@ -2,6 +2,6 @@ * $FreeBSD$ */ -void lm_init (void); +int lm_init (void); void lm_fini (void); char * lm_find (const char *, const char *); diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index e8cbf24..801fa4b 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -342,7 +342,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) #ifdef WITH_LIBMAP if (!libmap_disable) - lm_init(); + libmap_disable = (bool)lm_init(); #endif dbg("loading LD_PRELOAD libraries"); -- cgit v1.1