emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105816: * fileio.c: Report proper er


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105816: * fileio.c: Report proper errno when syscall falls.
Date: Sun, 18 Sep 2011 01:34:09 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105816
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-09-18 01:34:09 -0700
message:
  * fileio.c: Report proper errno when syscall falls.
  
  (Finsert_file_contents): Save and restore errno,
  so that report_file_error outputs the correct diagnostic.
  (Fwrite_region) [CLASH_DETECTION]: Likewise.
modified:
  src/ChangeLog
  src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-09-18 07:33:04 +0000
+++ b/src/ChangeLog     2011-09-18 08:34:09 +0000
@@ -1,3 +1,10 @@
+2011-09-18  Paul Eggert  <address@hidden>
+
+       * fileio.c: Report proper errno when syscall falls.
+       (Finsert_file_contents): Save and restore errno,
+       so that report_file_error outputs the correct diagnostic.
+       (Fwrite_region) [CLASH_DETECTION]: Likewise.
+
 2011-09-18  Eli Zaretskii  <address@hidden>
 
        * .gdbinit (pgx): Fix references to fields of `struct glyph'.

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2011-09-12 02:22:22 +0000
+++ b/src/fileio.c      2011-09-18 08:34:09 +0000
@@ -3187,6 +3187,7 @@
   Lisp_Object p;
   EMACS_INT total = 0;
   int not_regular = 0;
+  int save_errno = 0;
   char read_buf[READ_BUF_SIZE];
   struct coding_system coding;
   char buffer[1 << 14];
@@ -3250,6 +3251,7 @@
 #endif /* WINDOWSNT */
     {
     badopen:
+      save_errno = errno;
       if (NILP (visit))
        report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
       st.st_mtime = -1;
@@ -4281,6 +4283,7 @@
       && current_buffer->modtime == -1)
     {
       /* If visiting nonexistent file, return nil.  */
+      errno = save_errno;
       report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
     }
 
@@ -4618,7 +4621,9 @@
       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));


reply via email to

[Prev in Thread] Current Thread [Next in Thread]