-/* $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.
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);
}
-/* $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.
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);
}