diff options
author | 2008-08-20 18:28:46 +0000 | |
---|---|---|
committer | 2008-08-20 18:28:46 +0000 | |
commit | 48eceebc0bb0595827fc85e26e6311031160a03d (patch) | |
tree | 928c50829fb4811f061b06e812f9efbbea70f0b7 /usr.bin/patch/patch.c | |
parent | re-enable iso building (diff) | |
download | wireguard-openbsd-48eceebc0bb0595827fc85e26e6311031160a03d.tar.xz wireguard-openbsd-48eceebc0bb0595827fc85e26e6311031160a03d.zip |
The code to detect multiple applied diffs to empty files I introduced 4
years ago is not correct if the diff has an empty context for other
reasons, so revert that change. Problem found by Joerg Sonnenberger;
ok tedu@ millert@
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r-- | usr.bin/patch/patch.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 2ecee815ff5..6bef90a337c 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.45 2007/04/18 21:52:24 sobrado Exp $ */ +/* $OpenBSD: patch.c,v 1.46 2008/08/20 18:28:46 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.45 2007/04/18 21:52:24 sobrado Exp $"; +static const char rcsid[] = "$OpenBSD: patch.c,v 1.46 2008/08/20 18:28:46 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -631,13 +631,7 @@ locate_hunk(LINENUM fuzz) || diff_type == UNI_DIFF)) { say("Empty context always matches.\n"); } - 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); + return (first_guess); } if (max_neg_offset >= first_guess) /* do not try lines < 0 */ max_neg_offset = first_guess - 1; |