freebsd-src/usr.bin/patch
Pedro F. Giffuni 7e8afbb6d6 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)
2023-12-03 12:33:03 -05:00
..
tests Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
backupfile.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
backupfile.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
common.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
inp.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
inp.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
mkpath.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
patch.1 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
patch.c patch: fix locate_hunk in empty files 2023-12-03 12:33:03 -05:00
pathnames.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
pch.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
pch.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
util.c Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
util.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00