diff options
author | obrien <obrien@FreeBSD.org> | 2003-05-04 00:56:00 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2003-05-04 00:56:00 +0000 |
commit | 43ecc39077d55a2ece31e75c8e80612a8b840785 (patch) | |
tree | 5b9b023080432ede3e9df64830aa17a49633aaba /libexec | |
parent | bef29d279be2b25e16fa173fb9f5f5117075524e (diff) | |
download | FreeBSD-src-43ecc39077d55a2ece31e75c8e80612a8b840785.zip FreeBSD-src-43ecc39077d55a2ece31e75c8e80612a8b840785.tar.gz |
Fix signed/unsigned comparison warnings.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/malloc.c | 8 | ||||
-rw-r--r-- | libexec/rtld-elf/map_object.c | 7 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c index 974eb99..c93531e 100644 --- a/libexec/rtld-elf/malloc.c +++ b/libexec/rtld-elf/malloc.c @@ -178,7 +178,7 @@ malloc(nbytes) } bucket = 0; amt = 8; - while (pagesz > amt) { + while ((unsigned)pagesz > amt) { amt <<= 1; bucket++; } @@ -189,7 +189,7 @@ malloc(nbytes) * stored in hash buckets which satisfies request. * Account for space used per block for accounting. */ - if (nbytes <= (n = pagesz - sizeof (*op) - RSLOP)) { + if (nbytes <= (unsigned long)(n = pagesz - sizeof (*op) - RSLOP)) { #ifndef RCHECK amt = 8; /* size of first bucket */ bucket = 0; @@ -362,7 +362,7 @@ realloc(cp, nbytes) i = NBUCKETS; } onb = 1 << (i + 3); - if (onb < pagesz) + if (onb < (u_int)pagesz) onb -= sizeof (*op) + RSLOP; else onb += pagesz - sizeof (*op) - RSLOP; @@ -375,7 +375,7 @@ realloc(cp, nbytes) else i += pagesz - sizeof (*op) - RSLOP; } - if (nbytes <= onb && nbytes > i) { + if (nbytes <= onb && nbytes > (size_t)i) { #ifdef RCHECK op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 8e74e37..b7bbb1e 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -57,7 +57,8 @@ map_object(int fd, const char *path, const struct stat *sb) Elf_Ehdr hdr; char buf[PAGE_SIZE]; } u; - int nbytes, i; + int i; + ssize_t nbytes; Elf_Phdr *phdr; Elf_Phdr *phlimit; Elf_Phdr **segs; @@ -91,7 +92,7 @@ map_object(int fd, const char *path, const struct stat *sb) } /* Make sure the file is valid */ - if (nbytes < sizeof(Elf_Ehdr) + if (nbytes < (ssize_t)sizeof(Elf_Ehdr) || u.hdr.e_ident[EI_MAG0] != ELFMAG0 || u.hdr.e_ident[EI_MAG1] != ELFMAG1 || u.hdr.e_ident[EI_MAG2] != ELFMAG2 @@ -128,7 +129,7 @@ map_object(int fd, const char *path, const struct stat *sb) "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); return NULL; } - if (u.hdr.e_phoff + u.hdr.e_phnum*sizeof(Elf_Phdr) > nbytes) { + if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes) { _rtld_error("%s: program header too large", path); return NULL; } diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 2bd6584..06a78a6 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -943,7 +943,7 @@ gethints(void) } p = xmalloc(hdr.dirlistlen + 1); if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || - read(fd, p, hdr.dirlistlen + 1) != hdr.dirlistlen + 1) { + read(fd, p, hdr.dirlistlen + 1) != (ssize_t)hdr.dirlistlen + 1) { free(p); close(fd); return NULL; |