+2011-09-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ * 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 <eliz@gnu.org>
* .gdbinit (pgx): Fix references to fields of `struct glyph'.
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];
#endif /* WINDOWSNT */
{
badopen:
+ save_errno = errno;
if (NILP (visit))
report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
st.st_mtime = -1;
&& current_buffer->modtime == -1)
{
/* If visiting nonexistent file, return nil. */
+ errno = save_errno;
report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
}
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));