diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2010-07-15 11:10:24 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2010-07-15 11:10:24 +0000 |
commit | 69d865d664e8c74decbe33f48efb822fb002b28f (patch) | |
tree | 95109e63baefb2d372da9d03df3a5dd8286959e9 /usr.bin/cvs | |
parent | 2e5a724b70fd7655754f07e9cda3d3c7a061b3bb (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/cvs')
-rw-r--r-- | usr.bin/cvs/diff_internals.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c index 4baed471620..0eaf95039ec 100644 --- a/usr.bin/cvs/diff_internals.c +++ b/usr.bin/cvs/diff_internals.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff_internals.c,v 1.28 2009/06/07 08:39:13 ray Exp $ */ +/* $OpenBSD: diff_internals.c,v 1.29 2010/07/15 11:10:23 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -430,13 +430,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); } |