summaryrefslogtreecommitdiffstats
path: root/usr.bin/xlint
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
committeralex <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
commita3118e8c6826349b3fc54da3850d6dea994a3a35 (patch)
treed61898dd79824c10ca33127214d8569c804559c2 /usr.bin/xlint
parent752ba4d26f2e94cc31940f50407a6b18b86ee0e8 (diff)
downloadFreeBSD-src-a3118e8c6826349b3fc54da3850d6dea994a3a35.zip
FreeBSD-src-a3118e8c6826349b3fc54da3850d6dea994a3a35.tar.gz
Sweep through the tree fixing mmap() usage:
- Use MAP_FAILED instead of the constant -1 to indicate failure (required by POSIX). - Removed flag arguments of '0' (required by POSIX). - Fixed code which expected an error return of 0. - Fixed code which thought any address with the high bit set was an error. - Check for failure where no checks were present. Discussed with: bde
Diffstat (limited to 'usr.bin/xlint')
-rw-r--r--usr.bin/xlint/lint1/mem1.c2
-rw-r--r--usr.bin/xlint/lint2/mem2.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/xlint/lint1/mem1.c b/usr.bin/xlint/lint1/mem1.c
index df880b1..f3bf3c6 100644
--- a/usr.bin/xlint/lint1/mem1.c
+++ b/usr.bin/xlint/lint1/mem1.c
@@ -180,7 +180,7 @@ xnewblk()
prot = PROT_READ | PROT_WRITE;
flags = MAP_ANON | MAP_PRIVATE;
mb->blk = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
- if (mb->blk == (void *)-1)
+ if (mb->blk == (void *)MAP_FAILED)
err(1, "can't map memory");
if (ALIGN((u_long)mb->blk) != (u_long)mb->blk)
errx(1, "mapped address is not aligned");
diff --git a/usr.bin/xlint/lint2/mem2.c b/usr.bin/xlint/lint2/mem2.c
index 06d7491..ed97c6f 100644
--- a/usr.bin/xlint/lint2/mem2.c
+++ b/usr.bin/xlint/lint2/mem2.c
@@ -82,7 +82,7 @@ xalloc(sz)
prot = PROT_READ | PROT_WRITE;
flags = MAP_ANON | MAP_PRIVATE;
mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
- if (mbuf == (void *)-1)
+ if (mbuf == (void *)MAP_FAILED)
err(1, "can't map memory");
if (ALIGN((u_long)mbuf) != (u_long)mbuf)
errx(1, "mapped address is not aligned");
OpenPOWER on IntegriCloud