summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2010-07-15 11:10:24 +0000
committerRay Lai <ray@cvs.openbsd.org>2010-07-15 11:10:24 +0000
commit69d865d664e8c74decbe33f48efb822fb002b28f (patch)
tree95109e63baefb2d372da9d03df3a5dd8286959e9 /usr.bin/rcs
parent2e5a724b70fd7655754f07e9cda3d3c7a061b3bb (diff)
Sync with diff/diffreg.c r1.75:
Return -1 on error as advertised. Handle case when only one stream failed. OK xsa, stsp
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/diff.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c
index 8139c173119..e34cdaae409 100644
--- a/usr.bin/rcs/diff.c
+++ b/usr.bin/rcs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.26 2009/06/07 08:39:13 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.27 2010/07/15 11:10:23 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -413,13 +413,12 @@ files_differ(FILE *f1, FILE *f2)
for (;;) {
i = fread(buf1, 1, sizeof(buf1), f1);
j = fread(buf2, 1, sizeof(buf2), f2);
+ if ((!i && ferror(f1)) || (!j && ferror(f2)))
+ return (-1);
if (i != j)
return (1);
- if (i == 0 && j == 0) {
- if (ferror(f1) || ferror(f2))
- return (-1);
+ if (i == 0)
return (0);
- }
if (memcmp(buf1, buf2, i) != 0)
return (1);
}