summaryrefslogtreecommitdiffstats
path: root/libexec/lfs_cleanerd
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 /libexec/lfs_cleanerd
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 'libexec/lfs_cleanerd')
-rw-r--r--libexec/lfs_cleanerd/library.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c
index 9397f62..93951c6 100644
--- a/libexec/lfs_cleanerd/library.c
+++ b/libexec/lfs_cleanerd/library.c
@@ -204,8 +204,8 @@ get_ifile (fsp, use_mmap)
if (fsp->fi_cip)
munmap((caddr_t)fsp->fi_cip, fsp->fi_ifile_length);
ifp = mmap ((caddr_t)0, file_stat.st_size,
- PROT_READ|PROT_WRITE, 0, fid, (off_t)0);
- if (ifp == (caddr_t)(-1))
+ PROT_READ|PROT_WRITE, MAP_SHARED, fid, (off_t)0);
+ if (ifp == MAP_FAILED)
err(1, "get_ifile: mmap failed");
} else {
if (fsp->fi_cip)
@@ -541,8 +541,8 @@ mmap_segment (fsp, segment, segbuf, use_mmap)
if (use_mmap) {
*segbuf = mmap ((caddr_t)0, seg_size(lfsp), PROT_READ,
- 0, fid, seg_byte);
- if (*(long *)segbuf < 0) {
+ MAP_SHARED, fid, seg_byte);
+ if (*segbuf == MAP_FAILED) {
err(0, "mmap_segment: mmap failed");
return (NULL);
}
OpenPOWER on IntegriCloud