+ /* Do not setpgrp(2) in the parent process as the process-group
+ is shared for the whole sh(1) pipeline we could be a part
+ of. The process-group is set according to PID of the first
+ command in the pipeline.
+ We would rip even vi(1) in the case of:
+ ./orphanripper sh -c 'sleep 1&' | vi -
+ */
+ /* Do not setpgrp(2) as our pty would not be ours and we would
+ get `SIGSTOP' later, particularly after spawning gdb(1).
+ setsid(3) was already executed by forkpty(3) and it would fail if
+ executed again. */
+ if (getpid() != getpgrp ())
+ {
+ perror ("getpgrp(2)");
+ exit (EXIT_FAILURE);
+ }