From d815199e2e5b3bef043113758d8384cbe627d75f Mon Sep 17 00:00:00 2001 From: andersen Date: Wed, 3 Oct 2001 11:23:42 +0000 Subject: Patch from Magnus Damm to avoid lash hanging on serial ports git-svn-id: svn://busybox.net/trunk/busybox@3475 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- lash.c | 8 +++++++- shell/lash.c | 8 +++++++- 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); -- cgit v1.2.3-55-g6feb