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.
This commit is contained in:
Matthew N. Dodd 2003-09-13 21:43:08 +00:00
parent be2c4e5415
commit 4402996dea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120038
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -2,6 +2,6 @@
* $FreeBSD$
*/
void lm_init (void);
int lm_init (void);
void lm_fini (void);
char * lm_find (const char *, const char *);

View File

@ -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");