diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-06-18 17:52:26 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-06-18 17:52:26 +0000 |
commit | d4b9780367a05477a4f8e34e4a02e2a739067633 (patch) | |
tree | dba3fceace0cc75b33ff6c73650667bc94481b91 /usr.bin/patch | |
parent | 93897febe9bf811a2f1d43511976539850e29fbf (diff) |
Unbreak handling of standard diffs (which have an empty context).
ok @millert
Diffstat (limited to 'usr.bin/patch')
-rw-r--r-- | usr.bin/patch/patch.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 3efbd92a809..482f5b392e0 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.39 2004/06/14 18:26:33 otto Exp $ */ +/* $OpenBSD: patch.c,v 1.40 2004/06/18 17:52:25 otto Exp $ */ /* * patch - a program to apply diffs to original files @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: patch.c,v 1.39 2004/06/14 18:26:33 otto Exp $"; +static const char rcsid[] = "$OpenBSD: patch.c,v 1.40 2004/06/18 17:52:25 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -629,8 +629,13 @@ locate_hunk(LINENUM fuzz) || diff_type == UNI_DIFF)) { say("Empty context always matches.\n"); } - if (fuzz == 0) - return (input_lines == 0 ? first_guess : 0); + if (diff_type == CONTEXT_DIFF + || diff_type == NEW_CONTEXT_DIFF + || diff_type == UNI_DIFF) { + if (fuzz == 0) + return (input_lines == 0 ? first_guess : 0); + } else + return (first_guess); } if (max_neg_offset >= first_guess) /* do not try lines < 0 */ max_neg_offset = first_guess - 1; |