diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2021-04-13 14:20:25 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2021-04-13 14:20:25 +0000 |
commit | 157d630e707d0095f41c1c55c76b9e54197ff2aa (patch) | |
tree | 79d08aa9b629a85de47647027aeefd87d5194fad /usr.bin/rcs | |
parent | c98a7bb80b021ef1e3ab65d5702c73ad796a392f (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.c | 4 |
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++; |