[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113296: Use emacs_open more consistently when openi
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113296: Use emacs_open more consistently when opening files. |
Date: |
Sat, 06 Jul 2013 02:40:59 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113296
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-07-05 19:40:50 -0700
message:
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.
added:
src/sysstdio.h sysstdio.h-20130706023956-bacexoewp9z472m1-1
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/buffer.c buffer.c-20091113204419-o5vbwnq5f7feedwu-264
src/callproc.c callproc.c-20091113204419-o5vbwnq5f7feedwu-248
src/cygw32.c cygw32.c-20120917115700-3at3xhn4to67xnca-1
src/dispnew.c dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
src/emacs.c emacs.c-20091113204419-o5vbwnq5f7feedwu-241
src/fileio.c fileio.c-20091113204419-o5vbwnq5f7feedwu-210
src/image.c image.c-20091113204419-o5vbwnq5f7feedwu-2969
src/keyboard.c keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
src/lread.c lread.c-20091113204419-o5vbwnq5f7feedwu-266
src/print.c print.c-20091113204419-o5vbwnq5f7feedwu-262
src/sysdep.c sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
src/term.c term.c-20091113204419-o5vbwnq5f7feedwu-220
src/termcap.c termcap.c-20091113204419-o5vbwnq5f7feedwu-775
src/unexaix.c unexaix.c-20091113204419-o5vbwnq5f7feedwu-147
src/unexcoff.c unexec.c-20091113204419-o5vbwnq5f7feedwu-184
src/unexcw.c unexcw.c-20091113204419-o5vbwnq5f7feedwu-3010
src/unexelf.c unexelf.c-20091113204419-o5vbwnq5f7feedwu-426
src/unexhp9k800.c
unexhp9k800.c-20091113204419-o5vbwnq5f7feedwu-4481
src/unexmacosx.c
unexmacosx.c-20091113204419-o5vbwnq5f7feedwu-2413
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
src/xfaces.c xfaces.c-20091113204419-o5vbwnq5f7feedwu-560
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-07-05 16:58:01 +0000
+++ b/src/ChangeLog 2013-07-06 02:40:50 +0000
@@ -1,5 +1,37 @@
2013-07-05 Paul Eggert <address@hidden>
+ 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.
+
Remove duplicate #include directives.
* alloc.c [GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES]:
* xfaces.c:
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2013-07-05 16:58:01 +0000
+++ b/src/buffer.c 2013-07-06 02:40:50 +0000
@@ -4726,7 +4726,7 @@
if (mmap_fd <= 0)
{
/* No anonymous mmap -- we need the file descriptor. */
- mmap_fd = open ("/dev/zero", O_RDONLY);
+ mmap_fd = emacs_open ("/dev/zero", O_RDONLY, 0);
if (mmap_fd == -1)
fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno));
}
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2013-06-27 14:47:52 +0000
+++ b/src/callproc.c 2013-07-06 02:40:50 +0000
@@ -186,6 +186,12 @@
return Qnil;
}
+#ifdef DOS_NT
+static mode_t const default_output_mode = S_IREAD | S_IWRITE;
+#else
+static mode_t const default_output_mode = 0666;
+#endif
+
DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0,
doc: /* Call PROGRAM synchronously in separate process.
The remaining arguments are optional.
@@ -407,13 +413,9 @@
if (STRINGP (output_file))
{
-#ifdef DOS_NT
fd_output = emacs_open (SSDATA (output_file),
- O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
- S_IREAD | S_IWRITE);
-#else /* not DOS_NT */
- fd_output = creat (SSDATA (output_file), 0666);
-#endif /* not DOS_NT */
+ O_WRONLY | O_CREAT | O_TRUNC | O_TEXT,
+ default_output_mode);
if (fd_output < 0)
{
output_file = DECODE_FILE (output_file);
@@ -492,7 +494,8 @@
strcat (tempfile, "/");
strcat (tempfile, "detmp.XXX");
mktemp (tempfile);
- outfilefd = creat (tempfile, S_IREAD | S_IWRITE);
+ outfilefd = emacs_open (tempfile, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IREAD | S_IWRITE);
if (outfilefd < 0) {
emacs_close (filefd);
report_file_error ("Opening process output file",
@@ -535,15 +538,9 @@
if (NILP (error_file))
fd_error = emacs_open (NULL_DEVICE, O_WRONLY, 0);
else if (STRINGP (error_file))
- {
-#ifdef DOS_NT
- fd_error = emacs_open (SSDATA (error_file),
- O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
- S_IREAD | S_IWRITE);
-#else /* not DOS_NT */
- fd_error = creat (SSDATA (error_file), 0666);
-#endif /* not DOS_NT */
- }
+ fd_error = emacs_open (SSDATA (error_file),
+ O_WRONLY | O_CREAT | O_TRUNC | O_TEXT,
+ default_output_mode);
if (fd_error < 0)
{
=== modified file 'src/cygw32.c'
--- a/src/cygw32.c 2013-01-02 16:13:04 +0000
+++ b/src/cygw32.c 2013-07-06 02:40:50 +0000
@@ -35,7 +35,7 @@
chdir_to_default_directory ()
{
Lisp_Object new_cwd;
- int old_cwd_fd = open (".", O_RDONLY | O_DIRECTORY);
+ int old_cwd_fd = emacs_open (".", O_RDONLY | O_DIRECTORY, 0);
if (old_cwd_fd == -1)
error ("could not open current directory: %s", strerror (errno));
=== modified file 'src/dispnew.c'
--- a/src/dispnew.c 2013-04-02 01:54:56 +0000
+++ b/src/dispnew.c 2013-07-06 02:40:50 +0000
@@ -22,7 +22,7 @@
#define DISPEXTERN_INLINE EXTERN_INLINE
-#include <stdio.h>
+#include "sysstdio.h"
#include <unistd.h>
#include "lisp.h"
@@ -5605,17 +5605,17 @@
tty = CURTTY ();
if (tty->termscript != 0)
- {
- block_input ();
- fclose (tty->termscript);
- unblock_input ();
- }
- tty->termscript = 0;
+ {
+ block_input ();
+ fclose (tty->termscript);
+ tty->termscript = 0;
+ unblock_input ();
+ }
if (! NILP (file))
{
file = Fexpand_file_name (file, Qnil);
- tty->termscript = fopen (SSDATA (file), "w");
+ tty->termscript = emacs_fopen (SSDATA (file), "w");
if (tty->termscript == 0)
report_file_error ("Opening termscript", Fcons (file, Qnil));
}
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2013-07-04 06:20:55 +0000
+++ b/src/emacs.c 2013-07-06 02:40:50 +0000
@@ -2236,7 +2236,7 @@
error ("This function can only be called after loading the init files");
/* Get rid of stdin, stdout and stderr. */
- nfd = open ("/dev/null", O_RDWR);
+ nfd = emacs_open ("/dev/null", O_RDWR, 0);
err |= nfd < 0;
err |= dup2 (nfd, 0) < 0;
err |= dup2 (nfd, 1) < 0;
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2013-07-05 16:58:01 +0000
+++ b/src/fileio.c 2013-07-06 02:40:50 +0000
@@ -20,7 +20,7 @@
#include <config.h>
#include <limits.h>
#include <fcntl.h>
-#include <stdio.h>
+#include "sysstdio.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -5618,7 +5618,7 @@
UNGCPRO;
}
- stream = fopen (SSDATA (listfile), "w");
+ stream = emacs_fopen (SSDATA (listfile), "w");
}
record_unwind_protect (do_auto_save_unwind,
=== modified file 'src/image.c'
--- a/src/image.c 2013-07-04 15:25:54 +0000
+++ b/src/image.c 2013-07-06 02:40:50 +0000
@@ -18,7 +18,7 @@
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <stdio.h>
+#include "sysstdio.h"
#include <unistd.h>
#ifdef HAVE_PNG
@@ -2274,7 +2274,7 @@
static unsigned char *
slurp_file (char *file, ptrdiff_t *size)
{
- FILE *fp = fopen (file, "rb");
+ FILE *fp = emacs_fopen (file, "rb");
unsigned char *buf = NULL;
struct stat st;
@@ -5723,7 +5723,7 @@
}
/* Open the image file. */
- fp = fopen (SSDATA (file), "rb");
+ fp = emacs_fopen (SSDATA (file), "rb");
if (!fp)
{
image_error ("Cannot open image file `%s'", file, Qnil);
@@ -6484,7 +6484,7 @@
return 0;
}
- fp = fopen (SSDATA (file), "rb");
+ fp = emacs_fopen (SSDATA (file), "rb");
if (fp == NULL)
{
image_error ("Cannot open `%s'", file, Qnil);
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2013-07-06 00:10:54 +0000
+++ b/src/keyboard.c 2013-07-06 02:40:50 +0000
@@ -23,7 +23,7 @@
#define BLOCKINPUT_INLINE EXTERN_INLINE
#define KEYBOARD_INLINE EXTERN_INLINE
-#include <stdio.h>
+#include "sysstdio.h"
#include "lisp.h"
#include "termchar.h"
@@ -10129,7 +10129,7 @@
if (!NILP (file))
{
file = Fexpand_file_name (file, Qnil);
- dribble = fopen (SSDATA (file), "w");
+ dribble = emacs_fopen (SSDATA (file), "w");
if (dribble == 0)
report_file_error ("Opening dribble", Fcons (file, Qnil));
}
=== modified file 'src/lread.c'
--- a/src/lread.c 2013-07-05 16:58:01 +0000
+++ b/src/lread.c 2013-07-06 02:40:50 +0000
@@ -20,7 +20,7 @@
#include <config.h>
-#include <stdio.h>
+#include "sysstdio.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
@@ -1297,7 +1297,7 @@
if (fd >= 0)
{
emacs_close (fd);
- stream = fopen (SSDATA (efound), fmode);
+ stream = emacs_fopen (SSDATA (efound), fmode);
}
else
stream = NULL;
=== modified file 'src/print.c'
--- a/src/print.c 2013-07-02 03:41:16 +0000
+++ b/src/print.c 2013-07-06 02:40:50 +0000
@@ -20,7 +20,7 @@
#include <config.h>
-#include <stdio.h>
+#include "sysstdio.h"
#include "lisp.h"
#include "character.h"
@@ -765,7 +765,7 @@
{
file = Fexpand_file_name (file, Qnil);
initial_stderr_stream = stderr;
- stderr = fopen (SSDATA (file), NILP (append) ? "w" : "a");
+ stderr = emacs_fopen (SSDATA (file), NILP (append) ? "w" : "a");
if (stderr == NULL)
{
stderr = initial_stderr_stream;
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2013-07-02 22:14:42 +0000
+++ b/src/sysdep.c 2013-07-06 02:40:50 +0000
@@ -22,7 +22,7 @@
#define SYSTIME_INLINE EXTERN_INLINE
#include <execinfo.h>
-#include <stdio.h>
+#include "sysstdio.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <grp.h>
@@ -2151,15 +2151,29 @@
}
#endif
+/* Open FILE for Emacs use, using open flags OFLAG and mode MODE.
+ Do not fail merely because the open was interrupted by a signal.
+ Allow the user to quit. */
+
int
-emacs_open (const char *path, int oflag, int mode)
-{
- register int rtnval;
-
- while ((rtnval = open (path, oflag, mode)) == -1
- && (errno == EINTR))
- QUIT;
- return (rtnval);
+emacs_open (const char *file, int oflags, int mode)
+{
+ int fd;
+ while ((fd = open (file, oflags, mode)) < 0 && errno == EINTR)
+ QUIT;
+ return fd;
+}
+
+/* Open FILE as a stream for Emacs use, with mode MODE.
+ Act like emacs_open with respect to threads, signals, and quits. */
+
+FILE *
+emacs_fopen (char const *file, char const *mode)
+{
+ FILE *fp;
+ while (! (fp = fopen (file, mode)) && errno == EINTR)
+ QUIT;
+ return fp;
}
int
@@ -2637,7 +2651,7 @@
EMACS_TIME up = make_emacs_time (0, 0);
block_input ();
- fup = fopen ("/proc/uptime", "r");
+ fup = emacs_fopen ("/proc/uptime", "r");
if (fup)
{
@@ -2682,7 +2696,7 @@
char name[PATH_MAX];
block_input ();
- fdev = fopen ("/proc/tty/drivers", "r");
+ fdev = emacs_fopen ("/proc/tty/drivers", "r");
if (fdev)
{
@@ -2724,7 +2738,7 @@
unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */
block_input ();
- fmem = fopen ("/proc/meminfo", "r");
+ fmem = emacs_fopen ("/proc/meminfo", "r");
if (fmem)
{
=== added file 'src/sysstdio.h'
--- a/src/sysstdio.h 1970-01-01 00:00:00 +0000
+++ b/src/sysstdio.h 2013-07-06 02:40:50 +0000
@@ -0,0 +1,2 @@
+#include <stdio.h>
+extern FILE *emacs_fopen (char const *, char const *);
=== modified file 'src/term.c'
--- a/src/term.c 2013-06-03 19:28:13 +0000
+++ b/src/term.c 2013-07-06 02:40:50 +0000
@@ -2479,7 +2479,7 @@
const char *name;
int fd;
name = (const char *) ttyname (0);
- fd = open (name, O_WRONLY);
+ fd = emacs_open (name, O_WRONLY, 0);
SOME_FUNCTION (x, y, fd);
close (fd);
last_mouse_x = x;
=== modified file 'src/termcap.c'
--- a/src/termcap.c 2013-02-02 17:14:24 +0000
+++ b/src/termcap.c 2013-07-06 02:40:50 +0000
@@ -427,11 +427,7 @@
/* Here we know we must search a file and termcap_name has its name. */
-#ifdef MSDOS
- fd = open (termcap_name, O_RDONLY|O_TEXT, 0);
-#else
- fd = open (termcap_name, O_RDONLY, 0);
-#endif
+ fd = emacs_open (termcap_name, O_RDONLY | O_TEXT, 0);
if (fd < 0)
return -1;
=== modified file 'src/unexaix.c'
--- a/src/unexaix.c 2013-02-25 05:55:37 +0000
+++ b/src/unexaix.c 2013-07-06 02:40:50 +0000
@@ -42,6 +42,7 @@
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
#define PERROR(file) report_error (file, new)
#include <a.out.h>
@@ -132,11 +133,11 @@
{
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 @@
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;
=== modified file 'src/unexcoff.c'
--- a/src/unexcoff.c 2013-02-25 05:55:37 +0000
+++ b/src/unexcoff.c 2013-07-06 02:40:50 +0000
@@ -52,6 +52,7 @@
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
#define PERROR(file) report_error (file, new)
@@ -486,7 +487,7 @@
#ifdef MSDOS
if ((new = writedesc) < 0)
#else
- if ((new = open (new_name, O_RDWR)) < 0)
+ if ((new = emacs_open (new_name, O_RDWR, 0)) < 0)
#endif
{
PERROR (new_name);
@@ -525,11 +526,11 @@
{
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);
}
=== modified file 'src/unexcw.c'
--- a/src/unexcw.c 2013-03-22 16:52:31 +0000
+++ b/src/unexcw.c 2013-07-06 02:40:50 +0000
@@ -20,8 +20,8 @@
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
-#include <lisp.h>
#include <stdio.h>
#include <fcntl.h>
#include <a.out.h>
@@ -298,9 +298,9 @@
infile = add_exe_suffix_if_necessary (infile, infile_buffer);
outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer);
- fd_in = open (infile, O_RDONLY | O_BINARY);
+ fd_in = emacs_open (infile, O_RDONLY | O_BINARY, 0);
assert (fd_in >= 0);
- fd_out = open (outfile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY, 0755);
+ fd_out = emacs_open (outfile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY, 0755);
assert (fd_out >= 0);
for (;;)
{
=== modified file 'src/unexelf.c'
--- a/src/unexelf.c 2013-05-07 20:55:47 +0000
+++ b/src/unexelf.c 2013-07-06 02:40:50 +0000
@@ -386,9 +386,8 @@
Instead we read the whole file, modify it, and write it out. */
#include <config.h>
-#include <unexec.h>
-
-extern _Noreturn void fatal (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
+#include "unexec.h"
+#include "lisp.h"
#include <errno.h>
#include <fcntl.h>
@@ -672,7 +671,7 @@
/* Open the old file, allocate a buffer of the right size, and read
in the file contents. */
- old_file = open (old_name, O_RDONLY);
+ old_file = emacs_open (old_name, O_RDONLY, 0);
if (old_file < 0)
fatal ("Can't open %s for reading: %s", old_name, strerror (errno));
@@ -681,7 +680,7 @@
fatal ("Can't fstat (%s): %s", old_name, strerror (errno));
#if MAP_ANON == 0
- mmap_fd = open ("/dev/zero", O_RDONLY);
+ mmap_fd = emacs_open ("/dev/zero", O_RDONLY, 0);
if (mmap_fd < 0)
fatal ("Can't open /dev/zero for reading: %s", strerror (errno));
#endif
@@ -801,7 +800,7 @@
the image of the new file. Set pointers to various interesting
objects. */
- new_file = open (new_name, O_RDWR | O_CREAT, 0666);
+ new_file = emacs_open (new_name, O_RDWR | O_CREAT, 0666);
if (new_file < 0)
fatal ("Can't creat (%s): %s", new_name, strerror (errno));
=== modified file 'src/unexhp9k800.c'
--- a/src/unexhp9k800.c 2011-07-10 08:20:10 +0000
+++ b/src/unexhp9k800.c 2013-07-06 02:40:50 +0000
@@ -51,6 +51,7 @@
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
#include <stdio.h>
#include <fcntl.h>
@@ -268,10 +269,10 @@
intact. NOT implemented. */
/* Open the input and output a.out files */
- old = open (old_name, O_RDONLY);
+ old = emacs_open (old_name, O_RDONLY, 0);
if (old < 0)
{ perror (old_name); exit (1); }
- new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
+ new = emacs_open (new_name, O_CREAT | O_RDWR | O_TRUNC, 0777);
if (new < 0)
{ perror (new_name); exit (1); }
=== modified file 'src/unexmacosx.c'
--- a/src/unexmacosx.c 2013-01-23 01:51:49 +0000
+++ b/src/unexmacosx.c 2013-07-06 02:40:50 +0000
@@ -97,6 +97,7 @@
#undef free
#include "unexec.h"
+#include "lisp.h"
#include <stdio.h>
#include <fcntl.h>
@@ -1322,13 +1323,13 @@
unexec_error ("Unexec from a dumped executable is not supported.");
pagesize = getpagesize ();
- infd = open (infile, O_RDONLY, 0);
+ infd = emacs_open (infile, O_RDONLY, 0);
if (infd < 0)
{
unexec_error ("cannot open input file `%s'", infile);
}
- outfd = open (outfile, O_WRONLY | O_TRUNC | O_CREAT, 0755);
+ outfd = emacs_open (outfile, O_WRONLY | O_TRUNC | O_CREAT, 0755);
if (outfd < 0)
{
close (infd);
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2013-07-04 10:25:54 +0000
+++ b/src/w32term.c 2013-07-06 02:40:50 +0000
@@ -6621,7 +6621,7 @@
}
#ifdef CYGWIN
- if ((w32_message_fd = open ("/dev/windows", O_RDWR | O_CLOEXEC)) == -1)
+ if ((w32_message_fd = emacs_open ("/dev/windows", O_RDWR, 0)) == -1)
fatal ("opening /dev/windows: %s", strerror (errno));
#endif /* CYGWIN */
=== modified file 'src/xfaces.c'
--- a/src/xfaces.c 2013-07-05 16:58:01 +0000
+++ b/src/xfaces.c 2013-07-06 02:40:50 +0000
@@ -200,7 +200,7 @@
used to fill in unspecified attributes of the default face. */
#include <config.h>
-#include <stdio.h>
+#include "sysstdio.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -6290,7 +6290,7 @@
CHECK_STRING (filename);
abspath = Fexpand_file_name (filename, Qnil);
- fp = fopen (SSDATA (abspath), "rt");
+ fp = emacs_fopen (SSDATA (abspath), "rt");
if (fp)
{
char buf[512];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113296: Use emacs_open more consistently when opening files.,
Paul Eggert <=