summaryrefslogtreecommitdiff
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-11-10 09:00:43 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2018-11-10 09:04:42 -0800
commit9cd23a29147acb86c860ce11febe24cf837f3f8a (patch)
tree8d13a8949a3e4f67b2b7a9e3baa2944b9f4162b5 /src/callproc.c
parenta062fc4137ff195fe269076cda07a61c2e1a8012 (diff)
downloademacs-9cd23a29147acb86c860ce11febe24cf837f3f8a.tar.gz
emacs-9cd23a29147acb86c860ce11febe24cf837f3f8a.tar.bz2
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.c14
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,
#endif
unblock_child_signal (&oldset);
-
-#ifdef DARWIN_OS
- /* Darwin doesn't let us run setsid after a vfork, so use
- TIOCNOTTY when necessary. */
- int j = emacs_open (DEV_TTY, O_RDWR, 0);
- if (j >= 0)
- {
- ioctl (j, TIOCNOTTY, 0);
- emacs_close (j);
- }
-#else
- setsid ();
-#endif
+ dissociate_controlling_tty ();
/* Emacs ignores SIGPIPE, but the child should not. */
signal (SIGPIPE, SIG_DFL);