summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2021-04-13 14:20:25 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2021-04-13 14:20:25 +0000
commit157d630e707d0095f41c1c55c76b9e54197ff2aa (patch)
tree79d08aa9b629a85de47647027aeefd87d5194fad /usr.bin/rcs
parentc98a7bb80b021ef1e3ab65d5702c73ad796a392f (diff)
Fix merging of files that lack a final \n at EOF after a block of common lines.
Problem reported by Josh Rickmar. ok millert@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/diff3.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c
index ebe04a3b705..98643c5d740 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.44 2020/06/26 07:28:46 stsp Exp $ */
+/* $OpenBSD: diff3.c,v 1.45 2021/04/13 14:20:24 stsp Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -838,6 +838,8 @@ duplicate(struct range *r1, struct range *r2)
do {
c = getc(fp[0]);
d = getc(fp[1]);
+ if (c == -1 && d == -1)
+ break;
if (c == -1 || d== -1)
return (-1);
nchar++;