[gnu.emacs.bug] ^G kills children under SYSV, final solution?

ra@is.uu.no (Robert Andersson) (07/04/89)

Right after 18.54 was released a number of people complained that
^G killed emacs children under SYSV. Some people posted fixes.
I believe none of these were quite correct, since they broke support
for pty's under SYSV. Here is context diff's which I believe are correct:


*** process.c.orig	Sun Jun 18 03:56:32 1989
--- process.c	Sun Jun 18 03:55:25 1989
***************
*** 1001,1008 ****
  	int xforkout = forkout;
  
  	/* Make the pty be the controlling terminal of the process.  */
- #ifdef HAVE_PTYS
- 	/* First, disconnect its current controlling terminal.  */
  #ifdef USG
  	/* It's very important to call setpgrp() here and no time
  	   afterwards.  Otherwise, we lose our controlling tty which
--- 1001,1006 ----
***************
*** 1009,1014 ****
--- 1007,1014 ----
  	   is set when we open the pty. */
  	setpgrp ();
  #endif /* USG */
+ #ifdef HAVE_PTYS
+ 	/* First, disconnect its current controlling terminal.  */
  #ifdef TIOCNOTTY
  	/* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
  	   can do TIOCSPGRP only to the process's controlling tty.  */
***************
*** 1046,1051 ****
--- 1046,1055 ----
  #endif
  #endif /* HAVE_PTYS */
  	child_setup_tty (xforkout);
+ #ifndef USG
+         setpgrp (pid, pid);
+         setpgrp_of_tty (pid);
+ #endif /* USG */
  	child_setup (xforkin, xforkout, xforkout, new_argv, env);
        }
      environ = save_environ;


*** callproc.c.orig	Sun Jun 18 03:57:11 1989
--- callproc.c	Sun Jun 18 03:54:52 1989
***************
*** 197,202 ****
--- 197,208 ----
        {
  	if (fd[0] >= 0)
  	  close (fd[0]);
+ #ifdef USG
+         setpgrp();
+ #else
+         setpgrp (pid, pid);
+         setpgrp_of_tty (pid);
+ #endif /* USG */
  	child_setup (filefd, fd1, fd1, new_argv, env);
        }
  
***************
*** 372,382 ****
    close (in);
    close (out);
    close (err);
- 
- #ifndef USG
-   setpgrp (pid, pid);
-   setpgrp_of_tty (pid);
- #endif /* USG */
  
  #ifdef vipc
    something missing here;
--- 378,383 ----
-- 
Robert Andersson, International Systems, Oslo, Norway
Internet:         ra@is.uu.no
UUCP:             ...!{uunet,mcvax,ifi}!is.uu.no!ra