diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-06 19:57:48 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-06 19:57:48 +0000 |
commit | 0a805819559aedf0eeac98ae07fa46cab047fb99 (patch) | |
tree | 1e527b73bba3255a29fa3741babf55308250c770 /bin/ksh | |
parent | cea87994caa9c6553012812397ac6fd77a769756 (diff) |
Be more smart waiting for input for non-interactive scripts. Fix
based on a diff from debian: see their bug#296446. ok millert@
sobrado@
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/jobs.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c index 05d9d2a6ef4..53f58b5e4d2 100644 --- a/bin/ksh/jobs.c +++ b/bin/ksh/jobs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jobs.c,v 1.35 2006/02/06 16:47:07 jmc Exp $ */ +/* $OpenBSD: jobs.c,v 1.36 2007/09/06 19:57:47 otto Exp $ */ /* * Process and job control @@ -246,11 +246,17 @@ j_change(void) int i; if (Flag(FMONITOR)) { - /* Don't call tcgetattr() 'til we own the tty process group */ - tty_init(false); + int use_tty; + + if (Flag(FTALKING)) { + /* Don't call tcgetattr() 'til we own the tty process group */ + use_tty = 1; + tty_init(false); + } else + use_tty = 0; /* no controlling tty, no SIGT* */ - ttypgrp_ok = tty_fd >= 0 && tty_devtty; + ttypgrp_ok = use_tty && tty_fd >= 0 && tty_devtty; if (ttypgrp_ok && (our_pgrp = getpgrp()) < 0) { warningf(false, "j_init: getpgrp() failed: %s", @@ -296,8 +302,10 @@ j_change(void) our_pgrp = kshpid; } } - if (!ttypgrp_ok) - warningf(false, "warning: won't have full job control"); + if (use_tty) { + if (!ttypgrp_ok) + warningf(false, "warning: won't have full job control"); + } if (tty_fd >= 0) tcgetattr(tty_fd, &tty_state); } else { |