]> code.delx.au - gnu-emacs/blobdiff - src/fileio.c
Merge from trunk.
[gnu-emacs] / src / fileio.c
index 486c3d4c175f76fefb02e81e5f07140a918ecf99..110977b3a602f0523ef93c2fdbee884bfab20fa2 100644 (file)
@@ -3189,6 +3189,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
   Lisp_Object p;
   ptrdiff_t total = 0;
   int not_regular = 0;
+  int save_errno = 0;
   char read_buf[READ_BUF_SIZE];
   struct coding_system coding;
   char buffer[1 << 14];
@@ -3253,6 +3254,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 #endif /* WINDOWSNT */
     {
     badopen:
+      save_errno = errno;
       if (NILP (visit))
        report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
       st.st_mtime = -1;
@@ -4288,6 +4290,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
       && current_buffer->modtime == -1)
     {
       /* If visiting nonexistent file, return nil.  */
+      errno = save_errno;
       report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
     }
 
@@ -4625,7 +4628,9 @@ This calls `write-region-annotate-functions' at the start, and
       if (ret < 0)
        {
 #ifdef CLASH_DETECTION
+         save_errno = errno;
          if (!auto_saving) unlock_file (lockname);
+         errno = save_errno;
 #endif /* CLASH_DETECTION */
          UNGCPRO;
          report_file_error ("Lseek error", Fcons (filename, Qnil));