diff options
author | alex <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
commit | a3118e8c6826349b3fc54da3850d6dea994a3a35 (patch) | |
tree | d61898dd79824c10ca33127214d8569c804559c2 /bin/cp | |
parent | 752ba4d26f2e94cc31940f50407a6b18b86ee0e8 (diff) | |
download | FreeBSD-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 'bin/cp')
-rw-r--r-- | bin/cp/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 762cedf..cda81f8 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -121,7 +121,7 @@ copy_file(entp, dne) #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED if (fs->st_size <= 8 * 1048576) { if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ, - 0, from_fd, (off_t)0)) == (char *)-1) { + MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) { warn("%s", entp->fts_path); rval = 1; } else { |