diff options
| author | Bruce Evans <bde@FreeBSD.org> | 1994-09-15 20:48:55 +0000 |
|---|---|---|
| committer | Bruce Evans <bde@FreeBSD.org> | 1994-09-15 20:48:55 +0000 |
| commit | dd8e0158cf8c036bde226299b711eb9f6270d722 (patch) | |
| tree | 68cd72f885411c15a3b585136be0228a6bc6618b /libexec | |
| parent | d8f10c1117e644884520099f5e79ff4f9ac5a3d1 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/rtld-aout/rtld.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libexec/rtld-aout/rtld.c b/libexec/rtld-aout/rtld.c index 96dd0fe62673..d1ab40829355 100644 --- a/libexec/rtld-aout/rtld.c +++ b/libexec/rtld-aout/rtld.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: rtld.c,v 1.16 1994/04/13 20:52:40 ats Exp $ + * $Id: rtld.c,v 1.17 1994/06/15 22:41:15 rich Exp $ */ #include <sys/param.h> @@ -162,6 +162,7 @@ static void init_map __P((struct so_map *, char *)); static char *rtfindlib __P((char *, int, int, int *)); void binder_entry __P((void)); long binder __P((jmpslot_t *)); +static void unmaphints __P((void)); static struct nzlist *lookup __P((char *, struct so_map **, int)); static inline struct rt_symbol *lookup_rts __P((char *)); static struct rt_symbol *enter_rts __P((char *, long, int, caddr_t, @@ -293,6 +294,9 @@ struct _dynamic *dp; ddp->dd_sym_loaded = 1; } + /* Forget hints so that hints file can go away if it is unlinked */ + unmaphints(); + /* Close our file descriptor */ (void)close(crtp->crt_ldfd); return 0; @@ -949,6 +953,7 @@ xprintf(" BINDER: %s located at = %#x in %s\n", sym, addr, src_map->som_path); static struct hints_header *hheader; +static long hmsize; static struct hints_bucket *hbuckets; static char *hstrtab; @@ -970,6 +975,7 @@ maphints() addr = mmap(0, msize, PROT_READ, MAP_FILE|MAP_COPY, fd, 0); if (addr == (caddr_t)-1) { + close(fd); hheader = (struct hints_header *)-1; return; } @@ -977,22 +983,27 @@ maphints() hheader = (struct hints_header *)addr; if (HH_BADMAG(*hheader)) { munmap(addr, msize); + close(fd); hheader = (struct hints_header *)-1; return; } if (hheader->hh_version != LD_HINTS_VERSION_1) { munmap(addr, msize); + close(fd); hheader = (struct hints_header *)-1; return; } + hmsize = msize; if (hheader->hh_ehints > msize) { + hmsize = hheader->hh_ehints; if (mmap(addr+msize, hheader->hh_ehints - msize, PROT_READ, MAP_FILE|MAP_COPY|MAP_FIXED, fd, msize) != (caddr_t)(addr+msize)) { munmap((caddr_t)hheader, msize); + close(fd); hheader = (struct hints_header *)-1; return; } @@ -1003,6 +1014,15 @@ maphints() hstrtab = (char *)(addr + hheader->hh_strtab); } + static void +unmaphints() +{ + if (HINTS_VALID) { + munmap((caddr_t)hheader, hmsize); + hheader = NULL; + } +} + int hinthash(cp, vmajor, vminor) char *cp; |
