Initialise dfound outside loop so that 0 sized files compare correctly
and to that 'cmp -l' will exit with error is the last block matches. Pointed out in a private mail bt someone who wishes to remain anonymous.
This commit is contained in:
parent
690b6d996a
commit
48a0480288
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: regular.c,v 1.14 2005/02/06 21:19:46 dsl Exp $ */
|
||||
/* $NetBSD: regular.c,v 1.15 2005/03/07 07:51:42 dsl 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.14 2005/02/06 21:19:46 dsl Exp $");
|
||||
__RCSID("$NetBSD: regular.c,v 1.15 2005/03/07 07:51:42 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -69,6 +69,7 @@ c_regular(int fd1, char *file1, off_t skip1, off_t len1,
|
||||
eofmsg(file2);
|
||||
len2 -= skip2;
|
||||
|
||||
dfound = 0;
|
||||
length = MIN(len1, len2);
|
||||
for (blk_sz = 1024 * 1024; length != 0; length -= blk_sz) {
|
||||
if (blk_sz > length)
|
||||
@ -83,7 +84,6 @@ c_regular(int fd1, char *file1, off_t skip1, off_t len1,
|
||||
goto mmap_failed;
|
||||
}
|
||||
|
||||
dfound = 0;
|
||||
blk_cnt = blk_sz;
|
||||
for (byte = line = 1; blk_cnt--; ++p1, ++p2, ++byte) {
|
||||
if ((ch = *p1) != *p2) {
|
||||
|
Loading…
Reference in New Issue
Block a user