while (plist && *plist->data == "+-"[reverse]) {
if (data && !strcmp(data, plist->data+1)) {
if (!backwarn) {
- backwarn++;
+ backwarn = TT.linenum;
if (option_mask32 & FLAG_IGNORE) {
dummy_revert = 1;
reverse ^= 1;
continue;
}
- fdprintf(2,"Possibly reversed hunk %d at %ld\n",
- TT.hunknum, TT.linenum);
}
}
plist = plist->next;
// 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;
TT.filein = xopen3(name, O_CREAT|O_EXCL|O_RDWR, 0666);
} else {
printf("patching file %s\n", name);
- TT.filein = xopen(name, O_RDWR);
+ TT.filein = xopen(name, O_RDONLY);
}
TT.fileout = copy_tempfile(TT.filein, name, &TT.tempname);
TT.linenum = 0;