diff options
author | Alexander Langer <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
---|---|---|
committer | Alexander Langer <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
commit | 8abdc2eb40c03b97153f2a01bdb53927f3a336c1 (patch) | |
tree | d61898dd79824c10ca33127214d8569c804559c2 /usr.bin/look | |
parent | 839cc09e5384e6f8c0ebb9203052015b532cfce7 (diff) | |
download | src-test-8abdc2eb40c03b97153f2a01bdb53927f3a336c1.tar.gz src-test-8abdc2eb40c03b97153f2a01bdb53927f3a336c1.zip |
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
Notes
Notes:
svn path=/head/; revision=21786
Diffstat (limited to 'usr.bin/look')
-rw-r--r-- | usr.bin/look/look.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c index e2bd95285e4e9..daef12fd4361a 100644 --- a/usr.bin/look/look.c +++ b/usr.bin/look/look.c @@ -143,7 +143,7 @@ main(argc, argv) if (sb.st_size > SIZE_T_MAX) err("%s: %s", file, strerror(EFBIG)); if ((front = mmap(NULL, - (size_t)sb.st_size, PROT_READ, 0, fd, (off_t)0)) == NULL) + (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) err("%s: %s", file, strerror(errno)); back = front + sb.st_size; exit(look(string, front, back)); |