summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-09-13 21:43:08 +0000
committermdodd <mdodd@FreeBSD.org>2003-09-13 21:43:08 +0000
commitdf4cd81882926df08d6ac5b0f56b288b90c19ad9 (patch)
tree919ac9ae9921903ef959120200906c83c32193b7 /libexec
parent6a2b8b88fb01aab4a0beee48ef140b727917a621 (diff)
downloadFreeBSD-src-df4cd81882926df08d6ac5b0f56b288b90c19ad9.zip
FreeBSD-src-df4cd81882926df08d6ac5b0f56b288b90c19ad9.tar.gz
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.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/libmap.c6
-rw-r--r--libexec/rtld-elf/libmap.h2
-rw-r--r--libexec/rtld-elf/rtld.c2
3 files changed, 5 insertions, 5 deletions
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");
OpenPOWER on IntegriCloud