summaryrefslogtreecommitdiffstats
path: root/usr.bin/cmp/regular.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2021-01-09 09:58:12 +0000
committerotto <otto@openbsd.org>2021-01-09 09:58:12 +0000
commit20ca40a427324bcb9b2b5f7bf92a21b99ebdc224 (patch)
treeeaf7ba7a462c4f265c88182e3d08f6265900f43e /usr.bin/cmp/regular.c
parentAdd 'strip' directive (diff)
downloadwireguard-openbsd-20ca40a427324bcb9b2b5f7bf92a21b99ebdc224.tar.xz
wireguard-openbsd-20ca40a427324bcb9b2b5f7bf92a21b99ebdc224.zip
Move a premature optimization so that -s with offsets works.
ok florian@ tb@
Diffstat (limited to 'usr.bin/cmp/regular.c')
-rw-r--r--usr.bin/cmp/regular.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
index fb452f63758..a75cb18303a 100644
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: regular.c,v 1.12 2015/02/06 23:21:59 millert Exp $ */
+/* $OpenBSD: regular.c,v 1.13 2021/01/09 09:58:12 otto Exp $ */
/* $NetBSD: regular.c,v 1.2 1995/09/08 03:22:59 tls Exp $ */
/*-
@@ -51,9 +51,6 @@ c_regular(int fd1, char *file1, off_t skip1, off_t len1,
off_t byte, length, line;
int dfound;
- if (sflag && len1 != len2)
- exit(1);
-
if (skip1 > len1)
eofmsg(file1);
len1 -= skip1;
@@ -61,6 +58,9 @@ c_regular(int fd1, char *file1, off_t skip1, off_t len1,
eofmsg(file2);
len2 -= skip2;
+ if (sflag && len1 != len2)
+ exit(1);
+
length = MINIMUM(len1, len2);
if (length > SIZE_MAX) {
mmap_failed: