aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-09-18 01:34:09 -0700
committerPaul Eggert2011-09-18 01:34:09 -0700
commite5e9d610c9b435b9053bec512957c872b8fc031c (patch)
tree8a09d838c6027d13dbe4132d38ddb12091705c1a /src
parent5d5ac8ec033a741c6931ef874ac4c4caa0a9359c (diff)
downloademacs-e5e9d610c9b435b9053bec512957c872b8fc031c.tar.gz
emacs-e5e9d610c9b435b9053bec512957c872b8fc031c.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/fileio.c5
2 files changed, 12 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 835e70f99af..282275ffa06 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12011-09-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fileio.c: Report proper errno when syscall falls.
4 (Finsert_file_contents): Save and restore errno,
5 so that report_file_error outputs the correct diagnostic.
6 (Fwrite_region) [CLASH_DETECTION]: Likewise.
7
12011-09-18 Eli Zaretskii <eliz@gnu.org> 82011-09-18 Eli Zaretskii <eliz@gnu.org>
2 9
3 * .gdbinit (pgx): Fix references to fields of `struct glyph'. 10 * .gdbinit (pgx): Fix references to fields of `struct glyph'.
diff --git a/src/fileio.c b/src/fileio.c
index 08be41f9fe4..e335dcf027f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3187,6 +3187,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3187 Lisp_Object p; 3187 Lisp_Object p;
3188 EMACS_INT total = 0; 3188 EMACS_INT total = 0;
3189 int not_regular = 0; 3189 int not_regular = 0;
3190 int save_errno = 0;
3190 char read_buf[READ_BUF_SIZE]; 3191 char read_buf[READ_BUF_SIZE];
3191 struct coding_system coding; 3192 struct coding_system coding;
3192 char buffer[1 << 14]; 3193 char buffer[1 << 14];
@@ -3250,6 +3251,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3250#endif /* WINDOWSNT */ 3251#endif /* WINDOWSNT */
3251 { 3252 {
3252 badopen: 3253 badopen:
3254 save_errno = errno;
3253 if (NILP (visit)) 3255 if (NILP (visit))
3254 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 3256 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
3255 st.st_mtime = -1; 3257 st.st_mtime = -1;
@@ -4281,6 +4283,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4281 && current_buffer->modtime == -1) 4283 && current_buffer->modtime == -1)
4282 { 4284 {
4283 /* If visiting nonexistent file, return nil. */ 4285 /* If visiting nonexistent file, return nil. */
4286 errno = save_errno;
4284 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 4287 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
4285 } 4288 }
4286 4289
@@ -4618,7 +4621,9 @@ This calls `write-region-annotate-functions' at the start, and
4618 if (ret < 0) 4621 if (ret < 0)
4619 { 4622 {
4620#ifdef CLASH_DETECTION 4623#ifdef CLASH_DETECTION
4624 save_errno = errno;
4621 if (!auto_saving) unlock_file (lockname); 4625 if (!auto_saving) unlock_file (lockname);
4626 errno = save_errno;
4622#endif /* CLASH_DETECTION */ 4627#endif /* CLASH_DETECTION */
4623 UNGCPRO; 4628 UNGCPRO;
4624 report_file_error ("Lseek error", Fcons (filename, Qnil)); 4629 report_file_error ("Lseek error", Fcons (filename, Qnil));