diff options
| author | Gerd Moellmann | 2001-07-31 14:40:50 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-07-31 14:40:50 +0000 |
| commit | 2bd2273e7b54afb820a5897f3c1f368a64dfca97 (patch) | |
| tree | 33a09d368915d8e6aac2756f8c081118f3f54b52 /src | |
| parent | 7642acca1e2fdbca53a065065d9d28c7c8de40d0 (diff) | |
| download | emacs-2bd2273e7b54afb820a5897f3c1f368a64dfca97.tar.gz emacs-2bd2273e7b54afb820a5897f3c1f368a64dfca97.zip | |
(Finsert_file_contents): Don't treat a return value
of 0 from emacs_read as an IO error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index e09fac7e79b..a8edc2f75b7 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3863,14 +3863,18 @@ actually used.") | |||
| 3863 | while (total_read < trial) | 3863 | while (total_read < trial) |
| 3864 | { | 3864 | { |
| 3865 | nread = emacs_read (fd, buffer + total_read, trial - total_read); | 3865 | nread = emacs_read (fd, buffer + total_read, trial - total_read); |
| 3866 | if (nread <= 0) | 3866 | if (nread < 0) |
| 3867 | error ("IO error reading %s: %s", | 3867 | error ("IO error reading %s: %s", |
| 3868 | XSTRING (orig_filename)->data, emacs_strerror (errno)); | 3868 | XSTRING (orig_filename)->data, emacs_strerror (errno)); |
| 3869 | else if (nread == 0) | ||
| 3870 | break; | ||
| 3869 | total_read += nread; | 3871 | total_read += nread; |
| 3870 | } | 3872 | } |
| 3873 | |||
| 3871 | /* Scan this bufferful from the end, comparing with | 3874 | /* Scan this bufferful from the end, comparing with |
| 3872 | the Emacs buffer. */ | 3875 | the Emacs buffer. */ |
| 3873 | bufpos = total_read; | 3876 | bufpos = total_read; |
| 3877 | |||
| 3874 | /* Compare with same_at_start to avoid counting some buffer text | 3878 | /* Compare with same_at_start to avoid counting some buffer text |
| 3875 | as matching both at the file's beginning and at the end. */ | 3879 | as matching both at the file's beginning and at the end. */ |
| 3876 | while (bufpos > 0 && same_at_end > same_at_start | 3880 | while (bufpos > 0 && same_at_end > same_at_start |