X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d311d28c3f8a3c43e6ef33d68b852c5ea7f13239..929bb973dd3faf1655f03ac758942d5b009354ad:/src/fileio.c?ds=sidebyside diff --git a/src/fileio.c b/src/fileio.c index 486c3d4c17..110977b3a6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3189,6 +3189,7 @@ variable `last-coding-system-used' to the coding system actually used. */) Lisp_Object p; ptrdiff_t total = 0; int not_regular = 0; + int save_errno = 0; char read_buf[READ_BUF_SIZE]; struct coding_system coding; char buffer[1 << 14]; @@ -3253,6 +3254,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; @@ -4288,6 +4290,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)); } @@ -4625,7 +4628,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));