HomeFreeBSD

patch: fix locate_hunk in empty files

Description

patch: fix locate_hunk in empty files

if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation. Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
patch' and then again with patch -R' yields back the original file.

Obtained from: OpenBSD (CVS patch.c,v 1.71)

Details

Provenance
pfgAuthored on Dec 3 2023, 5:33 PM
Parents
rG970d73856b62: usbdevs: add quirk for WD MyPassport Ultra External HDD
Branches
Unknown
Tags
Unknown