aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Ruigrok van der Werven <asmodai@FreeBSD.org>2002-04-08 13:13:28 +0000
committerJeroen Ruigrok van der Werven <asmodai@FreeBSD.org>2002-04-08 13:13:28 +0000
commit3957ebe486e95d3cdbde5ee502e16aa290080c8a (patch)
treefd58e3b5a563f5ca363d4414622ef4e957a17c00
parent0dcf5283965eb05246691e319b623011320ca575 (diff)
downloadsrc-3957ebe486e95d3cdbde5ee502e16aa290080c8a.tar.gz
src-3957ebe486e95d3cdbde5ee502e16aa290080c8a.zip
Work correctly when skips are given.
Add $FreeBSD$ PR: 18597 Submitted by: Anatoly Vorobey <mellon@pobox.com>
Notes
Notes: svn path=/stable/3/; revision=94218
-rw-r--r--usr.bin/cmp/regular.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
index 3b82bae11a69..f5a9bda29135 100644
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#ifndef lint
@@ -61,9 +63,6 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
int dfound;
off_t pagemask, off1, off2;
- if (sflag && len1 != len2)
- exit(1);
-
if (skip1 > len1)
eofmsg(file1);
len1 -= skip1;
@@ -71,6 +70,9 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
eofmsg(file2);
len2 -= skip2;
+ if (sflag && len1 != len2)
+ exit(DIFF_EXIT);
+
pagemask = (off_t)getpagesize() - 1;
off1 = ROUNDPAGE(skip1);
off2 = ROUNDPAGE(skip2);