Use the current pgrp, not pid, when resetting the foreground process group.
authorMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 15:37:09 +0000 (15:37 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 2 May 2001 15:37:09 +0000 (15:37 -0000)
Fixes bizarre suspension when executing `echo`.

hush.c
shell/hush.c

diff --git a/hush.c b/hush.c
index 9134251f52e7b2a597a8bae7b38ca2d037a443c0..4641e59c8165f03b0fa810694d28886e9a799362 100644 (file)
--- a/hush.c
+++ b/hush.c
@@ -1186,7 +1186,7 @@ static int run_list_real(struct pipe *pi)
                                if (tcsetpgrp(0, pi->pgrp) && errno != ENOTTY)
                                        perror_msg("tcsetpgrp");
                                rcode = pipe_wait(pi);
-                               if (tcsetpgrp(0, getpid()) && errno != ENOTTY)
+                               if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY)
                                        perror_msg("tcsetpgrp");
                                signal(SIGTTIN, SIG_DFL);
                                signal(SIGTTOU, SIG_DFL);
index 9134251f52e7b2a597a8bae7b38ca2d037a443c0..4641e59c8165f03b0fa810694d28886e9a799362 100644 (file)
@@ -1186,7 +1186,7 @@ static int run_list_real(struct pipe *pi)
                                if (tcsetpgrp(0, pi->pgrp) && errno != ENOTTY)
                                        perror_msg("tcsetpgrp");
                                rcode = pipe_wait(pi);
-                               if (tcsetpgrp(0, getpid()) && errno != ENOTTY)
+                               if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY)
                                        perror_msg("tcsetpgrp");
                                signal(SIGTTIN, SIG_DFL);
                                signal(SIGTTOU, SIG_DFL);