aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/process.c b/src/process.c
index 3c0e53f7784..16600f94ce4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1739,7 +1739,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1739 /* Make the pty be the controlling terminal of the process. */ 1739 /* Make the pty be the controlling terminal of the process. */
1740#ifdef HAVE_PTYS 1740#ifdef HAVE_PTYS
1741 /* First, disconnect its current controlling terminal. */ 1741 /* First, disconnect its current controlling terminal. */
1742#ifdef HAVE_SETSID
1743 /* We tried doing setsid only if pty_flag, but it caused 1742 /* We tried doing setsid only if pty_flag, but it caused
1744 process_set_signal to fail on SGI when using a pipe. */ 1743 process_set_signal to fail on SGI when using a pipe. */
1745 setsid (); 1744 setsid ();
@@ -1752,12 +1751,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1752 ioctl (xforkin, TIOCSCTTY, 0); 1751 ioctl (xforkin, TIOCSCTTY, 0);
1753#endif 1752#endif
1754 } 1753 }
1755#else /* not HAVE_SETSID */
1756 /* It's very important to call setpgid here and no time
1757 afterwards. Otherwise, we lose our controlling tty which
1758 is set when we open the pty. */
1759 setpgid (0, 0);
1760#endif /* not HAVE_SETSID */
1761#if defined (LDISC1) 1754#if defined (LDISC1)
1762 if (pty_flag && xforkin >= 0) 1755 if (pty_flag && xforkin >= 0)
1763 { 1756 {
@@ -1790,22 +1783,15 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1790 ioctl (j, TIOCNOTTY, 0); 1783 ioctl (j, TIOCNOTTY, 0);
1791 emacs_close (j); 1784 emacs_close (j);
1792 } 1785 }
1793#ifndef USG
1794 /* In order to get a controlling terminal on some versions
1795 of BSD, it is necessary to put the process in pgrp 0
1796 before it opens the terminal. */
1797 setpgid (0, 0);
1798#endif
1799 } 1786 }
1800#endif /* TIOCNOTTY */ 1787#endif /* TIOCNOTTY */
1801 1788
1802#if !defined (DONT_REOPEN_PTY) 1789#if !defined (DONT_REOPEN_PTY)
1803/*** There is a suggestion that this ought to be a 1790/*** There is a suggestion that this ought to be a
1804 conditional on TIOCSPGRP, 1791 conditional on TIOCSPGRP, or !defined TIOCSCTTY.
1805 or !(defined (HAVE_SETSID) && defined (TIOCSCTTY)).
1806 Trying the latter gave the wrong results on Debian GNU/Linux 1.1; 1792 Trying the latter gave the wrong results on Debian GNU/Linux 1.1;
1807 that system does seem to need this code, even though 1793 that system does seem to need this code, even though
1808 both HAVE_SETSID and TIOCSCTTY are defined. */ 1794 both TIOCSCTTY is defined. */
1809 /* Now close the pty (if we had it open) and reopen it. 1795 /* Now close the pty (if we had it open) and reopen it.
1810 This makes the pty the controlling terminal of the subprocess. */ 1796 This makes the pty the controlling terminal of the subprocess. */
1811 if (pty_flag) 1797 if (pty_flag)