summaryrefslogtreecommitdiff
path: root/src/unexaix.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-07-05 19:40:50 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-07-05 19:40:50 -0700
commit406af475be236b874e3633b68999f6a099d47587 (patch)
tree4dfc0e61b3fce353adedc96f84091aca4ae23b57 /src/unexaix.c
parent0773c610689c7612b0d7b44e61701079b6f56419 (diff)
downloademacs-406af475be236b874e3633b68999f6a099d47587.tar.gz
Use emacs_open more consistently when opening files.
This handles EINTR more consistently now, and makes it easier to introduce other uniform changes to file descriptor handling. * src/systdio.h: New file. * src/buffer.c (mmap_init): * cygw32.c (chdir_to_default_directory): * dispnew.c (Fopen_termscript): * emacs.c (Fdaemon_initialized): * fileio.c (Fdo_auto_save): * image.c (slurp_file, png_load_body, jpeg_load_body): * keyboard.c (Fopen_dribble_file): * lread.c (Fload): * print.c (Fredirect_debugging_output): * sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory): * termcap.c (tgetent): * unexaix.c, unexcoff.c (unexec, adjust_lnnoptrs): * unexcw.c, unexelf.c, unexhp9k800.c, unexmacosx.c (unexec): * w32term.c (w32_initialize) [CYGWIN]: * xfaces.c (Fx_load_color_file): Use emacs_open instead of plain open, and emacs_fopen instead of plain fopen. * dispnew.c, fileio.c, image.c, keyboard.c, lread.c, print.c, sysdep.c: * xfaces.c: Include sysstdio.h rather than stdio.h, for emacs_fopen. * callproc.c (default_output_mode): New constant. (Fcall_process): Use it to call emacs_open instead of plain creat. * dispnew.c (Fopen_termscript): Fix minor race in opening termscript. * sysdep.c (emacs_open): Add commentary and don't call file name "path". (emacs_fopen): New function. * unexaix.c, unexcoff.c, unexelf.c, unexhp9k800.c, unexmacosx.c: Include <lisp.h>, for emacs_open. * unexelf.c (fatal): Remove decl; not needed with <lisp.h> included.
Diffstat (limited to 'src/unexaix.c')
-rw-r--r--src/unexaix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/unexaix.c b/src/unexaix.c
index 44a824b8c12..204f6cf4ad3 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -42,6 +42,7 @@ what you give them. Help stamp out software-hoarding! */
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
#define PERROR(file) report_error (file, new)
#include <a.out.h>
@@ -132,11 +133,11 @@ unexec (const char *new_name, const char *a_name)
{
int new = -1, a_out = -1;
- if (a_name && (a_out = open (a_name, O_RDONLY)) < 0)
+ if (a_name && (a_out = emacs_open (a_name, O_RDONLY, 0)) < 0)
{
PERROR (a_name);
}
- if ((new = creat (new_name, 0666)) < 0)
+ if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
{
PERROR (new_name);
}
@@ -503,7 +504,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
if (!lnnoptr || !f_hdr.f_symptr)
return 0;
- if ((new = open (new_name, O_RDWR)) < 0)
+ if ((new = emacs_open (new_name, O_RDWR, 0)) < 0)
{
PERROR (new_name);
return -1;