diff options
Diffstat (limited to 'Src/init.c')
-rw-r--r-- | Src/init.c | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/Src/init.c b/Src/init.c index 939c4619f..2118a5f5f 100644 --- a/Src/init.c +++ b/Src/init.c @@ -354,7 +354,6 @@ printhelp(void) mod_export void init_io(void) { - long ttpgrp; static char outbuf[BUFSIZ], errbuf[BUFSIZ]; #ifdef RSH_BUG_WORKAROUND @@ -462,37 +461,8 @@ init_io(void) */ mypid = (zlong)getpid(); if (opts[MONITOR] && interact && (SHTTY != -1)) { - if ((mypgrp = GETPGRP()) > 0) { - sigset_t blockset, oldset; - sigemptyset(&blockset); - sigaddset(&blockset, SIGTTIN); - sigaddset(&blockset, SIGTTOU); - sigaddset(&blockset, SIGTSTP); - oldset = signal_block(blockset); - while ((ttpgrp = gettygrp()) != -1 && ttpgrp != mypgrp) { - mypgrp = GETPGRP(); - if (mypgrp == mypid) { - signal_setmask(oldset); - attachtty(mypgrp); /* Might generate SIGT* */ - signal_block(blockset); - } - if (mypgrp == gettygrp()) - break; - signal_setmask(oldset); - read(0, NULL, 0); /* Might generate SIGT* */ - signal_block(blockset); - mypgrp = GETPGRP(); - } - if (mypgrp != mypid) { - if (setpgrp(0, 0) == 0) { - mypgrp = mypid; - attachtty(mypgrp); - } else - opts[MONITOR] = 0; - } - signal_setmask(oldset); - } else - opts[MONITOR] = 0; + origpgrp = GETPGRP(); + acquire_pgrp(); /* might also clear opts[MONITOR] */ } else opts[MONITOR] = 0; #else |