diff options
author | trociny <trociny@FreeBSD.org> | 2011-10-15 19:08:22 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2011-10-15 19:08:22 +0000 |
commit | 5edcf5899db7cc6cdce03abaa26bda3fadf4548a (patch) | |
tree | 1e1f6ecd10cf7a74d4aaef9b1144ec2a7bd197dc /usr.bin/script/script.c | |
parent | 5bfe25432f47fc51db50d501a15474b6dadf73af (diff) | |
download | FreeBSD-src-5edcf5899db7cc6cdce03abaa26bda3fadf4548a.zip FreeBSD-src-5edcf5899db7cc6cdce03abaa26bda3fadf4548a.tar.gz |
In r225809 the intention was to send VEOF only once if STDIN was not a
terminal. Unfortunately the fix was incorrect and for flushtime > 0 it
keept sending VEOF.
Sent VEOF generates ^D\b\b echoed by the terminal, which was reported
in bin/161526. Note, we still send VEOF at least once. Otherwise
commands like below would hang forever:
echo 1 |script /tmp/script.out cat
PR: bin/161526
Reported by: Adrian Wontroba <aw1@stade.co.uk>, Stefan Bethke <stb@lassitu.de>
Tested by: Stefan Bethke <stb@lassitu.de>
MFC after: 3 days
Diffstat (limited to 'usr.bin/script/script.c')
-rw-r--r-- | usr.bin/script/script.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index ea5a1f6..cd577f7 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -163,12 +163,15 @@ main(int argc, char *argv[]) FD_SET(master, &rfd); if (readstdin) FD_SET(STDIN_FILENO, &rfd); - if ((!readstdin && ttyflg) || flushtime > 0) { - tv.tv_sec = !readstdin && ttyflg ? 1 : - flushtime - (tvec - start); + if (!readstdin && ttyflg) { + tv.tv_sec = 1; tv.tv_usec = 0; tvp = &tv; readstdin = 1; + } else if (flushtime > 0) { + tv.tv_sec = flushtime - (tvec - start); + tv.tv_usec = 0; + tvp = &tv; } else { tvp = NULL; } |