Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2011 19:08:23 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r226403 - head/usr.bin/script
Message-ID:  <201110151908.p9FJ8NNP026728@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Sat Oct 15 19:08:22 2011
New Revision: 226403
URL: http://svn.freebsd.org/changeset/base/226403

Log:
  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

Modified:
  head/usr.bin/script/script.c

Modified: head/usr.bin/script/script.c
==============================================================================
--- head/usr.bin/script/script.c	Sat Oct 15 18:41:25 2011	(r226402)
+++ head/usr.bin/script/script.c	Sat Oct 15 19:08:22 2011	(r226403)
@@ -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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110151908.p9FJ8NNP026728>