diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-10-07 22:24:22 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-10-07 22:53:34 -0400 |
commit | 7a7b85dad89929601c0cba18578f499f519b559a (patch) | |
tree | 7074a47e1c228c08401c5b49082baf9337ffccdd | |
parent | 13d8b0f9c2d61301d64b02832f848e17942b9f4c (diff) |
ldso: use MAP_FAILED with ld.so.cache
Rather than use our own custom casted -1 value, just use the MAP_FAILED
that common code already sets up for us for mmap().
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | ldso/ldso/dl-elf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 75e8f7186..d1cf2d771 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -45,14 +45,14 @@ int _dl_map_cache(void) libentry_t *libent; int i, strtabsize; - if (_dl_cache_addr == (caddr_t) - 1) + if (_dl_cache_addr == MAP_FAILED) return -1; else if (_dl_cache_addr != NULL) return 0; if (_dl_stat(LDSO_CACHE, &st) || (fd = _dl_open(LDSO_CACHE, O_RDONLY, 0)) < 0) { - _dl_cache_addr = (caddr_t) - 1; /* so we won't try again */ + _dl_cache_addr = MAP_FAILED; /* so we won't try again */ return -1; } @@ -96,13 +96,13 @@ int _dl_map_cache(void) fail: _dl_munmap(_dl_cache_addr, _dl_cache_size); - _dl_cache_addr = (caddr_t) - 1; + _dl_cache_addr = MAP_FAILED; return -1; } int _dl_unmap_cache(void) { - if (_dl_cache_addr == NULL || _dl_cache_addr == (caddr_t) - 1) + if (_dl_cache_addr == NULL || _dl_cache_addr == MAP_FAILED) return -1; #if 1 @@ -264,7 +264,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt, * the hard coded paths that follow (i.e before /lib and /usr/lib). */ #ifdef __LDSO_CACHE_SUPPORT__ - if (_dl_cache_addr != NULL && _dl_cache_addr != (caddr_t) - 1) { + if (_dl_cache_addr != NULL && _dl_cache_addr != MAP_FAILED) { int i; header_t *header = (header_t *) _dl_cache_addr; libentry_t *libent = (libentry_t *) & header[1]; |