diff options
| author | Paul Eggert | 2018-11-10 09:00:43 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-11-10 09:04:42 -0800 |
| commit | 9cd23a29147acb86c860ce11febe24cf837f3f8a (patch) | |
| tree | 8d13a8949a3e4f67b2b7a9e3baa2944b9f4162b5 /src/callproc.c | |
| parent | a062fc4137ff195fe269076cda07a61c2e1a8012 (diff) | |
| download | emacs-9cd23a29147acb86c860ce11febe24cf837f3f8a.tar.gz emacs-9cd23a29147acb86c860ce11febe24cf837f3f8a.zip | |
Dissociate controlling tty better on Darwin
* src/process.c (dissociate_controlling_tty): New function.
(create_process): Use it to dissociate controlling tty if setsid
fails, which happens on Darwin after a vfork (Bug#33154).
Do this on all platforms, not just on Darwin, as a similar
problem is plausible elsewhere.
* src/callproc.c (call_process): Use the new function here, too,
for consistency and to avoid duplicate code.
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/callproc.c b/src/callproc.c index a2cfd2e94da..9f47c79b81a 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -643,19 +643,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 643 | #endif | 643 | #endif |
| 644 | 644 | ||
| 645 | unblock_child_signal (&oldset); | 645 | unblock_child_signal (&oldset); |
| 646 | 646 | dissociate_controlling_tty (); | |
| 647 | #ifdef DARWIN_OS | ||
| 648 | /* Darwin doesn't let us run setsid after a vfork, so use | ||
| 649 | TIOCNOTTY when necessary. */ | ||
| 650 | int j = emacs_open (DEV_TTY, O_RDWR, 0); | ||
| 651 | if (j >= 0) | ||
| 652 | { | ||
| 653 | ioctl (j, TIOCNOTTY, 0); | ||
| 654 | emacs_close (j); | ||
| 655 | } | ||
| 656 | #else | ||
| 657 | setsid (); | ||
| 658 | #endif | ||
| 659 | 647 | ||
| 660 | /* Emacs ignores SIGPIPE, but the child should not. */ | 648 | /* Emacs ignores SIGPIPE, but the child should not. */ |
| 661 | signal (SIGPIPE, SIG_DFL); | 649 | signal (SIGPIPE, SIG_DFL); |