aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ctm
diff options
context:
space:
mode:
authorAlexander Langer <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
committerAlexander Langer <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
commit8abdc2eb40c03b97153f2a01bdb53927f3a336c1 (patch)
treed61898dd79824c10ca33127214d8569c804559c2 /usr.sbin/ctm
parent839cc09e5384e6f8c0ebb9203052015b532cfce7 (diff)
downloadsrc-8abdc2eb40c03b97153f2a01bdb53927f3a336c1.tar.gz
src-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.sbin/ctm')
-rw-r--r--usr.sbin/ctm/mkCTM/mkctm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ctm/mkCTM/mkctm.c b/usr.sbin/ctm/mkCTM/mkctm.c
index 24c3aaacb204..698d1143b883 100644
--- a/usr.sbin/ctm/mkCTM/mkctm.c
+++ b/usr.sbin/ctm/mkCTM/mkctm.c
@@ -179,11 +179,11 @@ Equ(const char *dir1, const char *dir2, const char *name, struct dirent *de)
}
#endif
p1=mmap(0, s1.st_size, PROT_READ, MAP_PRIVATE, fd1, 0);
- if ((int)p1 == -1) { perror(buf1); exit(3); }
+ if (p1 == (u_char *)MAP_FAILED) { perror(buf1); exit(3); }
close(fd1);
p2=mmap(0, s2.st_size, PROT_READ, MAP_PRIVATE, fd2, 0);
- if ((int)p2 == -1) { perror(buf2); exit(3); }
+ if (p2 == (u_char *)MAP_FAILED) { perror(buf2); exit(3); }
close(fd2);
/* If identical, we're done. */
@@ -322,7 +322,7 @@ Add(const char *dir1, const char *dir2, const char *name, struct dirent *de)
if (fd1 < 0) {perror(buf2); exit (3); }
fstat(fd1, &st);
p1=mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd1, 0);
- if ((int)p1 == -1) { perror(buf2); exit(3); }
+ if (p1 == (u_char *)MAP_FAILED) { perror(buf2); exit(3); }
close(fd1);
m2 = MD5Data(p1, st.st_size, md5_2);
name_stat("CTMFM", dir2, name, de);