diff src/fileio.c @ 39457:dbb9a3969094

(Finsert_file_contents): If REPLACE is non-nil, stop reading at EOF.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 26 Sep 2001 15:29:49 +0000
parents f9c8c910fe9a
children 5d5957da979a
line wrap: on
line diff
--- a/src/fileio.c	Wed Sep 26 15:26:30 2001 +0000
+++ b/src/fileio.c	Wed Sep 26 15:29:49 2001 +0000
@@ -3870,7 +3870,7 @@
 	    report_file_error ("Setting file position",
 			       Fcons (orig_filename, Qnil));
 
-	  total_read = 0;
+	  total_read = nread = 0;
 	  while (total_read < trial)
 	    {
 	      nread = emacs_read (fd, buffer + total_read, trial - total_read);
@@ -3905,6 +3905,9 @@
 		giveup_match_end = 1;
 	      break;
 	    }
+
+	  if (nread == 0)
+	    break;
 	}
       immediate_quit = 0;