# HG changeset patch # User Richard M. Stallman # Date 769475698 0 # Node ID 9f0893928a4d0d3dda02d8112b9612135d911fce # Parent 23edba0a5c5e17b6081be2a6d0ceac51a1aee379 (Finsert_file_contents): Declare buffer as unsigned char. When comparing with file size convert same_at_start to distance to buffer start. If the file matches the buffer contents truncate the buffer to the size of the file. diff -r 23edba0a5c5e -r 9f0893928a4d src/fileio.c --- a/src/fileio.c Fri May 20 22:27:30 1994 +0000 +++ b/src/fileio.c Fri May 20 23:14:58 1994 +0000 @@ -2694,10 +2694,12 @@ immediate_quit = 0; /* If the file matches the buffer completely, there's no need to replace anything. */ - if (same_at_start == st.st_size) + if (same_at_start - BEGV == st.st_size) { close (fd); specpdl_ptr--; + /* Truncate the buffer to the size of the file. */ + del_range_1 (same_at_start, same_at_end, 0); goto handled; } immediate_quit = 1;