aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/patch.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/editors/patch.c b/editors/patch.c
index c40f54155..0bde2cab3 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -344,14 +344,12 @@ static int apply_one_hunk(void)
344 while (plist && *plist->data == "+-"[reverse]) { 344 while (plist && *plist->data == "+-"[reverse]) {
345 if (data && !strcmp(data, plist->data+1)) { 345 if (data && !strcmp(data, plist->data+1)) {
346 if (!backwarn) { 346 if (!backwarn) {
347 backwarn++; 347 backwarn = TT.linenum;
348 if (option_mask32 & FLAG_IGNORE) { 348 if (option_mask32 & FLAG_IGNORE) {
349 dummy_revert = 1; 349 dummy_revert = 1;
350 reverse ^= 1; 350 reverse ^= 1;
351 continue; 351 continue;
352 } 352 }
353 fdprintf(2,"Possibly reversed hunk %d at %ld\n",
354 TT.hunknum, TT.linenum);
355 } 353 }
356 } 354 }
357 plist = plist->next; 355 plist = plist->next;
@@ -364,6 +362,10 @@ static int apply_one_hunk(void)
364 // Does this hunk need to match EOF? 362 // Does this hunk need to match EOF?
365 if (!plist && matcheof) break; 363 if (!plist && matcheof) break;
366 364
365 if (backwarn)
366 fdprintf(2,"Possibly reversed hunk %d at %ld\n",
367 TT.hunknum, TT.linenum);
368
367 // File ended before we found a place for this hunk. 369 // File ended before we found a place for this hunk.
368 fail_hunk(); 370 fail_hunk();
369 goto done; 371 goto done;
@@ -592,7 +594,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
592 TT.filein = xopen3(name, O_CREAT|O_EXCL|O_RDWR, 0666); 594 TT.filein = xopen3(name, O_CREAT|O_EXCL|O_RDWR, 0666);
593 } else { 595 } else {
594 printf("patching file %s\n", name); 596 printf("patching file %s\n", name);
595 TT.filein = xopen(name, O_RDWR); 597 TT.filein = xopen(name, O_RDONLY);
596 } 598 }
597 TT.fileout = copy_tempfile(TT.filein, name, &TT.tempname); 599 TT.fileout = copy_tempfile(TT.filein, name, &TT.tempname);
598 TT.linenum = 0; 600 TT.linenum = 0;