diff options
| author | Richard M. Stallman | 1994-05-20 23:14:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-20 23:14:58 +0000 |
| commit | 1051b3b3ef16e4ff1575ef22eec533a80fc7142d (patch) | |
| tree | a84470c655d60721a818df4c24c3c880c0d3d5f8 /src | |
| parent | 2d2eeace3b81236793dc26491a8abcaa1385c878 (diff) | |
| download | emacs-1051b3b3ef16e4ff1575ef22eec533a80fc7142d.tar.gz emacs-1051b3b3ef16e4ff1575ef22eec533a80fc7142d.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 60473ede63d..8d02ca3fdaa 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2694,10 +2694,12 @@ and (2) it puts less data in the undo list.") | |||
| 2694 | immediate_quit = 0; | 2694 | immediate_quit = 0; |
| 2695 | /* If the file matches the buffer completely, | 2695 | /* If the file matches the buffer completely, |
| 2696 | there's no need to replace anything. */ | 2696 | there's no need to replace anything. */ |
| 2697 | if (same_at_start == st.st_size) | 2697 | if (same_at_start - BEGV == st.st_size) |
| 2698 | { | 2698 | { |
| 2699 | close (fd); | 2699 | close (fd); |
| 2700 | specpdl_ptr--; | 2700 | specpdl_ptr--; |
| 2701 | /* Truncate the buffer to the size of the file. */ | ||
| 2702 | del_range_1 (same_at_start, same_at_end, 0); | ||
| 2701 | goto handled; | 2703 | goto handled; |
| 2702 | } | 2704 | } |
| 2703 | immediate_quit = 1; | 2705 | immediate_quit = 1; |