summaryrefslogtreecommitdiff
path: root/src/unexcoff.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-07-12 10:30:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-07-12 10:30:48 -0700
commita773ed9ac83b950cb2a934e9d54e1880f44bd350 (patch)
treeaa859e605867e85ae4fdee5401deddb18e0a630a /src/unexcoff.c
parent7e649856bce883738622cc3533ad808c6ea1a73f (diff)
downloademacs-a773ed9ac83b950cb2a934e9d54e1880f44bd350.tar.gz
Clean up errno reporting and fix some errno-reporting bugs.
* callproc.c (Fcall_process): * fileio.c (Fcopy_file, Finsert_file_contents, Fwrite_region): * process.c (create_process, Fmake_network_process): * unexaix.c (report_error): * unexcoff.c (report_error): Be more careful about reporting the errno of failed operations. The code previously reported the wrong errno sometimes. Also, prefer report_file_errno to setting errno + report_file_error. (Fcall_process): Look at openp return value rather than at path, as that's a bit faster and clearer when there's a numeric predicate. * fileio.c (report_file_errno): New function, with most of the old contents of report_file_error. (report_file_error): Use it. (Ffile_exists_p, Ffile_accessible_directory_p): Set errno to 0 when it is junk. * fileio.c (Faccess_file): * image.c (x_create_bitmap_from_file): Use faccessat rather than opening the file, to avoid the hassle of having a file descriptor open. * lisp.h (report_file_errno): New decl. * lread.c (Flocate_file_internal): File descriptor 0 is valid, too.
Diffstat (limited to 'src/unexcoff.c')
-rw-r--r--src/unexcoff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 6b2a3336c8a..c467e59a665 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -127,9 +127,10 @@ static int pagemask;
static void
report_error (const char *file, int fd)
{
+ int err = errno;
if (fd)
emacs_close (fd);
- report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
+ report_file_errno ("Cannot unexec", Fcons (build_string (file), Qnil), err);
}
#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1