summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb
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.sbin/kvm_mkdb
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.sbin/kvm_mkdb')
-rw-r--r--usr.sbin/kvm_mkdb/nlist.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c
index adf4a42..58d66fa 100644
--- a/usr.sbin/kvm_mkdb/nlist.c
+++ b/usr.sbin/kvm_mkdb/nlist.c
@@ -88,6 +88,9 @@ create_knlist(name, db)
filep = (u_char*)mmap(0, sst.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (filep == (u_char*)MAP_FAILED)
+ err(1, "mmap failed");
+
/* Read in exec structure. */
ebuf = (struct exec *) filep;
OpenPOWER on IntegriCloud