diff options
| author | Paul Eggert | 2013-07-09 00:04:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-07-09 00:04:48 -0700 |
| commit | 4ebbdd6712c1966406b40d2673464949775cbd7a (patch) | |
| tree | 08667dd241629ca55c2c30ce19777bd7ec107cfa /src/process.c | |
| parent | 584ee3fc72260acb3cc83f4d1a047b733a08ca17 (diff) | |
| download | emacs-4ebbdd6712c1966406b40d2673464949775cbd7a.tar.gz emacs-4ebbdd6712c1966406b40d2673464949775cbd7a.zip | |
Handle errno and exit status a bit more carefully.
* lib/ignore-value.h: Remove this gnulib-imported file.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Remove ignore-value.
* src/callproc.c (child_setup) [!DOS_NT]: Don't try to stuff an error
number into an exit status. Instead, use EXIT_CANCELED.
(child_setup) [!MSDOS]: Avoid possible deadlock with vfork.
* src/callproc.c (relocate_fd):
* src/emacs.c (close_output_streams, main):
* src/process.c (create_process):
* src/sysdep.c (sys_subshell) [!DOS_NT || !WINDOWSNT]:
Use emacs_perror for simplicity.
* src/callproc.c (relocate_fd, main):
* src/sysdep.c (sys_subshell):
Exit with EXIT_CANCELED etc., not 1, when exec setup fails.
(shut_down_emacs): Use emacs_write, not write.
* src/emacs.c, src/sysdep.c: Don't include <ignore-value.h>.
* src/fileio.c (Fcopy_file, e_write):
* src/nsterm.m (ns_select):
* src/process.c (send_process):
* src/sound.c (vox_write):
Use emacs_write_sig, not emacs_write.
* src/lisp.h (emacs_write_sig, emacs_perror): New decls.
* src/process.h (EXIT_CANCELED), EXIT_CANNOT_INVOKE, EXIT_ENOENT):
New constants.
* src/sysdep.c (emacs_backtrace): Use emacs_write, not ignore_value
of write.
(emacs_full_write): New function.
(emacs_write): Rewrite to use it.
(emacswrite_sig, emacs_perror): New functions.
* src/xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c index 1c210649024..36ca1cf6784 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1752,7 +1752,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1752 | tcgetattr (xforkin, &t); | 1752 | tcgetattr (xforkin, &t); |
| 1753 | t.c_lflag = LDISC1; | 1753 | t.c_lflag = LDISC1; |
| 1754 | if (tcsetattr (xforkin, TCSANOW, &t) < 0) | 1754 | if (tcsetattr (xforkin, TCSANOW, &t) < 0) |
| 1755 | emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); | 1755 | emacs_perror ("create_process/tcsetattr LDISC1"); |
| 1756 | } | 1756 | } |
| 1757 | #else | 1757 | #else |
| 1758 | #if defined (NTTYDISC) && defined (TIOCSETD) | 1758 | #if defined (NTTYDISC) && defined (TIOCSETD) |
| @@ -1799,10 +1799,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1799 | 1799 | ||
| 1800 | if (xforkin < 0) | 1800 | if (xforkin < 0) |
| 1801 | { | 1801 | { |
| 1802 | emacs_write (1, "Couldn't open the pty terminal ", 31); | 1802 | emacs_perror (pty_name); |
| 1803 | emacs_write (1, pty_name, strlen (pty_name)); | 1803 | _exit (EXIT_CANCELED); |
| 1804 | emacs_write (1, "\n", 1); | ||
| 1805 | _exit (1); | ||
| 1806 | } | 1804 | } |
| 1807 | 1805 | ||
| 1808 | } | 1806 | } |
| @@ -5503,7 +5501,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, | |||
| 5503 | written = emacs_gnutls_write (p, cur_buf, cur_len); | 5501 | written = emacs_gnutls_write (p, cur_buf, cur_len); |
| 5504 | else | 5502 | else |
| 5505 | #endif | 5503 | #endif |
| 5506 | written = emacs_write (outfd, cur_buf, cur_len); | 5504 | written = emacs_write_sig (outfd, cur_buf, cur_len); |
| 5507 | rv = (written ? 0 : -1); | 5505 | rv = (written ? 0 : -1); |
| 5508 | #ifdef ADAPTIVE_READ_BUFFERING | 5506 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5509 | if (p->read_output_delay > 0 | 5507 | if (p->read_output_delay > 0 |