From f0a4ac82166dbaedeae1d5f92821b700fc8fa17f Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 3 Oct 2001 11:23:42 +0000 Subject: Patch from Magnus Damm to avoid lash hanging on serial ports --- shell/lash.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shell') diff --git a/shell/lash.c b/shell/lash.c index 22e3c77..b3f7cb6 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.1