aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-10-03 11:23:42 +0000
committerEric Andersen <andersen@codepoet.org>2001-10-03 11:23:42 +0000
commitf0a4ac82166dbaedeae1d5f92821b700fc8fa17f (patch)
treea7a2cc60c67966f5a69d6a94ccb5900d4bc9ae80
parent35636540ea96c11a4cd58e733279a8daea9b8dee (diff)
downloadbusybox-f0a4ac82166dbaedeae1d5f92821b700fc8fa17f.tar.gz
Patch from Magnus Damm <damm@opensource.se> to avoid lash hanging
on serial ports
-rw-r--r--lash.c8
-rw-r--r--shell/lash.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/lash.c b/lash.c
index 22e3c779e..b3f7cb6a8 100644
--- a/lash.c
+++ b/lash.c
@@ -1524,9 +1524,15 @@ void free_memory(void)
* we don't fight over who gets the foreground */
static void setup_job_control()
{
+ int status;
+
/* Loop until we are in the foreground. */
- while (tcgetpgrp (shell_terminal) != (shell_pgrp = getpgrp ()))
+ while ((status = tcgetpgrp (shell_terminal)) >= 0) {
+ if (status == (shell_pgrp = getpgrp ())) {
+ break;
+ }
kill (- shell_pgrp, SIGTTIN);
+ }
/* Ignore interactive and job-control signals. */
signal(SIGINT, SIG_IGN);
diff --git a/shell/lash.c b/shell/lash.c
index 22e3c779e..b3f7cb6a8 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1524,9 +1524,15 @@ void free_memory(void)
* we don't fight over who gets the foreground */
static void setup_job_control()
{
+ int status;
+
/* Loop until we are in the foreground. */
- while (tcgetpgrp (shell_terminal) != (shell_pgrp = getpgrp ()))
+ while ((status = tcgetpgrp (shell_terminal)) >= 0) {
+ if (status == (shell_pgrp = getpgrp ())) {
+ break;
+ }
kill (- shell_pgrp, SIGTTIN);
+ }
/* Ignore interactive and job-control signals. */
signal(SIGINT, SIG_IGN);