changeset 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 d2d0681907f9
children 30f1175b2a9f
files src/fileio.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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;