diff options
author | 2015-01-16 06:39:28 +0000 | |
---|---|---|
committer | 2015-01-16 06:39:28 +0000 | |
commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /usr.bin/cmp/regular.c | |
parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
download | wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip |
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/cmp/regular.c')
-rw-r--r-- | usr.bin/cmp/regular.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index 95ebc1bbbe0..f95f64e1e2b 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regular.c,v 1.10 2011/01/19 13:01:25 okan Exp $ */ +/* $OpenBSD: regular.c,v 1.11 2015/01/16 06:40:06 deraadt Exp $ */ /* $NetBSD: regular.c,v 1.2 1995/09/08 03:22:59 tls Exp $ */ /*- @@ -30,7 +30,6 @@ * SUCH DAMAGE. */ -#include <sys/param.h> #include <sys/mman.h> #include <sys/stat.h> @@ -42,6 +41,8 @@ #include "extern.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + void c_regular(int fd1, char *file1, off_t skip1, off_t len1, int fd2, char *file2, off_t skip2, off_t len2) @@ -60,7 +61,7 @@ c_regular(int fd1, char *file1, off_t skip1, off_t len1, eofmsg(file2); len2 -= skip2; - length = MIN(len1, len2); + length = MINIMUM(len1, len2); if (length > SIZE_T_MAX) { mmap_failed: c_special(fd1, file1, skip1, fd2, file2, skip2); |