CVSROOT:        /cvs
Module name:    src
Changes by:     s...@cvs.openbsd.org    2020/06/26 01:28:47

Modified files:
        usr.bin/rcs    : diff3.c 
        usr.bin/cvs    : diff3.c 
        usr.bin/diff3  : diff3prog.c 

Log message:
Fix merging of files that lack newlines for diff(3), OpenRCS, and OpenCVS.

Merges with a file that lacks newlines (\n) were triggering a fatal error.
This could be easily reproduced with merge(1) and diff3(1):
$ echo foo > foo
$ echo bar > bar
$ echo -n baz > baz
$ merge -p foo bar baz
merge: failed to merge
$ diff3 -E foo bar baz
1a
=======
diff3prog: logic error
$

Fix this by properly handling short reads from the third file argument.
Only the third file argument triggered the problem. The other input
files were already handled correctly.

ok millert@

Reply via email to