Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/cmp PR/55916: William Ahern: cmp -s + regular files ...



details:   https://anonhg.NetBSD.org/src/rev/29cab2621883
branches:  trunk
changeset: 949312:29cab2621883
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 09 15:16:28 2021 +0000

description:
PR/55916: William Ahern: cmp -s + regular files + skipping is broken
Move test after length is adjusted

diffstat:

 usr.bin/cmp/regular.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 2e566741b81d -r 29cab2621883 usr.bin/cmp/regular.c
--- a/usr.bin/cmp/regular.c     Sat Jan 09 15:07:42 2021 +0000
+++ b/usr.bin/cmp/regular.c     Sat Jan 09 15:16:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: regular.c,v 1.24 2013/11/20 17:19:14 kleink Exp $      */
+/*     $NetBSD: regular.c,v 1.25 2021/01/09 15:16:28 christos Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)regular.c  8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: regular.c,v 1.24 2013/11/20 17:19:14 kleink Exp $");
+__RCSID("$NetBSD: regular.c,v 1.25 2021/01/09 15:16:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,9 +59,6 @@
        int dfound;
        size_t blk_sz, blk_cnt;
 
-       if (sflag && len1 != len2)
-               exit(1);
-
        if (skip1 > len1)
                eofmsg(file1, len1 + 1, 0);
        len1 -= skip1;
@@ -69,6 +66,9 @@
                eofmsg(file2, len2 + 1, 0);
        len2 -= skip2;
 
+       if (sflag && len1 != len2)
+               exit(DIFF_EXIT);
+
        byte = line = 1;
        dfound = 0;
        length = MIN(len1, len2);



Home | Main Index | Thread Index | Old Index