Module Name: src Committed By: christos Date: Sat Jan 9 15:16:28 UTC 2021
Modified Files: src/usr.bin/cmp: regular.c Log Message: PR/55916: William Ahern: cmp -s + regular files + skipping is broken Move test after length is adjusted To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/cmp/regular.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/cmp/regular.c diff -u src/usr.bin/cmp/regular.c:1.24 src/usr.bin/cmp/regular.c:1.25 --- src/usr.bin/cmp/regular.c:1.24 Wed Nov 20 12:19:14 2013 +++ src/usr.bin/cmp/regular.c Sat Jan 9 10:16:28 2021 @@ -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 @@ c_regular(int fd1, const char *file1, of 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 @@ c_regular(int fd1, const char *file1, of eofmsg(file2, len2 + 1, 0); len2 -= skip2; + if (sflag && len1 != len2) + exit(DIFF_EXIT); + byte = line = 1; dfound = 0; length = MIN(len1, len2);