aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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));