]> git.eshelyaron.com Git - emacs.git/commitdiff
(Finsert_file_contents): Don't treat a return value
authorGerd Moellmann <gerd@gnu.org>
Tue, 31 Jul 2001 14:40:50 +0000 (14:40 +0000)
committerGerd Moellmann <gerd@gnu.org>
Tue, 31 Jul 2001 14:40:50 +0000 (14:40 +0000)
of 0 from emacs_read as an IO error.

src/fileio.c

index e09fac7e79bb2ede6a5f0b49559e7614a902ddc5..a8edc2f75b7b8aa89bdb63779712a74af3c4e16d 100644 (file)
@@ -3863,14 +3863,18 @@ actually used.")
          while (total_read < trial)
            {
              nread = emacs_read (fd, buffer + total_read, trial - total_read);
-             if (nread <= 0)
+             if (nread < 0)
                error ("IO error reading %s: %s",
                       XSTRING (orig_filename)->data, emacs_strerror (errno));
+             else if (nread == 0)
+               break;
              total_read += nread;
            }
+         
          /* Scan this bufferful from the end, comparing with
             the Emacs buffer.  */
          bufpos = total_read;
+         
          /* Compare with same_at_start to avoid counting some buffer text
             as matching both at the file's beginning and at the end.  */
          while (bufpos > 0 && same_at_end > same_at_start