aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>2011-09-18 01:34:09 -0700
committerPaul Eggert <[email protected]>2011-09-18 01:34:09 -0700
commite5e9d610c9b435b9053bec512957c872b8fc031c (patch)
tree8a09d838c6027d13dbe4132d38ddb12091705c1a /src
parent5d5ac8ec033a741c6931ef874ac4c4caa0a9359c (diff)
* 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 835e70f99a..282275ffa0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-18 Paul Eggert <[email protected]>
+
+ * 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 <[email protected]>
* .gdbinit (pgx): Fix references to fields of `struct glyph'.
diff --git a/src/fileio.c b/src/fileio.c
index 08be41f9fe..e335dcf027 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3187,6 +3187,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
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 @@ 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;
@@ -4281,6 +4283,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));
}
@@ -4618,7 +4621,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));