aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/patch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/patch.c b/toys/patch.c
index dab3fbfb..974885ce 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -148,11 +148,7 @@ static int apply_one_hunk(void)
// of the hunk we'd be adding.)
while (plist && *plist->data == "+-"[reverse]) {
if (data && !strcmp(data, plist->data+1)) {
- if (!backwarn) {
- fdprintf(2,"Possibly reversed hunk %d at %ld\n",
- TT.hunknum, TT.linenum);
- backwarn++;
- }
+ if (!backwarn) backwarn = TT.linenum;
}
plist = plist->next;
}
@@ -164,6 +160,10 @@ static int apply_one_hunk(void)
// Does this hunk need to match EOF?
if (!plist && matcheof) break;
+ if (backwarn)
+ fdprintf(2,"Possibly reversed hunk %d at %ld\n",
+ TT.hunknum, TT.linenum);
+
// File ended before we found a place for this hunk.
fail_hunk();
goto done;