=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/patch.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- src/usr.bin/patch/patch.c 2022/08/03 07:25:44 1.70 +++ src/usr.bin/patch/patch.c 2022/08/03 07:30:37 1.71 @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.70 2022/08/03 07:25:44 op Exp $ */ +/* $OpenBSD: patch.c,v 1.71 2022/08/03 07:30:37 op Exp $ */ /* * patch - a program to apply diffs to original files @@ -651,6 +651,8 @@ || diff_type == UNI_DIFF)) { say("Empty context always matches.\n"); } + if (first_guess == 0) + return 1; return (first_guess); } if (max_neg_offset >= first_guess) /* do not try lines < 0 */