* src/fileio.c (Finsert_file_contents): If the file unexpectedly
shrinks while reading its tail backwards, give up searching for
the match end.
(cherry picked from commit
f4adb56c9adc9b4f4715c656f1f8cfa7305479e5)
report_file_error ("Read error", orig_filename);
else if (nread == 0)
{
+ /* The file unexpectedly shrank. */
file_size_hint = curpos - trial + total_read;
+ giveup_match_end = true;
break;
}
total_read += nread;
}
+ if (giveup_match_end)
+ break;
+
/* Scan this bufferful from the end, comparing with
the Emacs buffer. */
bufpos = total_read;