diff options
-rw-r--r-- | lash.c | 8 | ||||
-rw-r--r-- | shell/lash.c | 8 |
2 files changed, 14 insertions, 2 deletions
@@ -1524,9 +1524,15 @@ void free_memory(void) | |||
1524 | * we don't fight over who gets the foreground */ | 1524 | * we don't fight over who gets the foreground */ |
1525 | static void setup_job_control() | 1525 | static void setup_job_control() |
1526 | { | 1526 | { |
1527 | int status; | ||
1528 | |||
1527 | /* Loop until we are in the foreground. */ | 1529 | /* Loop until we are in the foreground. */ |
1528 | while (tcgetpgrp (shell_terminal) != (shell_pgrp = getpgrp ())) | 1530 | while ((status = tcgetpgrp (shell_terminal)) >= 0) { |
1531 | if (status == (shell_pgrp = getpgrp ())) { | ||
1532 | break; | ||
1533 | } | ||
1529 | kill (- shell_pgrp, SIGTTIN); | 1534 | kill (- shell_pgrp, SIGTTIN); |
1535 | } | ||
1530 | 1536 | ||
1531 | /* Ignore interactive and job-control signals. */ | 1537 | /* Ignore interactive and job-control signals. */ |
1532 | signal(SIGINT, SIG_IGN); | 1538 | 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) | |||
1524 | * we don't fight over who gets the foreground */ | 1524 | * we don't fight over who gets the foreground */ |
1525 | static void setup_job_control() | 1525 | static void setup_job_control() |
1526 | { | 1526 | { |
1527 | int status; | ||
1528 | |||
1527 | /* Loop until we are in the foreground. */ | 1529 | /* Loop until we are in the foreground. */ |
1528 | while (tcgetpgrp (shell_terminal) != (shell_pgrp = getpgrp ())) | 1530 | while ((status = tcgetpgrp (shell_terminal)) >= 0) { |
1531 | if (status == (shell_pgrp = getpgrp ())) { | ||
1532 | break; | ||
1533 | } | ||
1529 | kill (- shell_pgrp, SIGTTIN); | 1534 | kill (- shell_pgrp, SIGTTIN); |
1535 | } | ||
1530 | 1536 | ||
1531 | /* Ignore interactive and job-control signals. */ | 1537 | /* Ignore interactive and job-control signals. */ |
1532 | signal(SIGINT, SIG_IGN); | 1538 | signal(SIGINT, SIG_IGN); |