2006-12-12
authorlace <>
Tue, 10 Jul 2007 14:33:06 +0000 (14:33 +0000)
committerlace <>
Tue, 10 Jul 2007 14:33:06 +0000 (14:33 +0000)
src/orphanripper.c

index 9613b92..0b302f7 100644 (file)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
  * Reap any leftover children possibly holding file descriptors.
- * 2006-11-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
+ * 2006-12-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
  */
 
 
@@ -56,8 +56,10 @@ static int spawn (char **argv, pid_t *child_pointer)
                   We would rip even vi(1) in the case of:
                        ./orphanripper sh -c 'sleep 1&' | vi -
                   */
-               if (setpgrp ()) {
-                       perror ("setpgrp");
+               /* Do not setpgrp(2) as our pty would not be ours and we would
+                  get `SIGSTOP' later, particularly after spawning gdb(1).  */
+               if (getpid() != setsid ()) {
+                       perror ("setsid");
                        exit (EXIT_FAILURE);
                }
                execvp (argv[1], argv + 1);