Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/cmp Initialise dfound outside loop so that 0 sized f...
details: https://anonhg.NetBSD.org/src/rev/5bf0b07c705e
branches: trunk
changeset: 574626:5bf0b07c705e
user: dsl <dsl%NetBSD.org@localhost>
date: Mon Mar 07 07:51:42 2005 +0000
description:
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.
diffstat:
usr.bin/cmp/regular.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r da65809a9e6b -r 5bf0b07c705e usr.bin/cmp/regular.c
--- a/usr.bin/cmp/regular.c Mon Mar 07 03:17:21 2005 +0000
+++ b/usr.bin/cmp/regular.c Mon Mar 07 07:51:42 2005 +0000
@@ -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 @@
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 @@
goto mmap_failed;
}
- dfound = 0;
blk_cnt = blk_sz;
for (byte = line = 1; blk_cnt--; ++p1, ++p2, ++byte) {
if ((ch = *p1) != *p2) {
Home |
Main Index |
Thread Index |
Old Index