Date: Wed, 10 Nov 2010 21:54:15 -0800 (PST) From: "Ronald F.Guilmette" <rfg@tristatelogic.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/152131: Useless code in script.c (part 1) Message-ID: <20101111055415.20E8BBDC35@segfault.tristatelogic.com> Resent-Message-ID: <201011110600.oAB60MRs022146@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 152131 >Category: bin >Synopsis: Useless code in script.c (part 1) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Nov 11 06:00:22 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Ronald F. Guilmette >Release: FreeBSD 7.0-RELEASE i386 >Organization: Infinite Monkeys & Co. >Environment: System: FreeBSD segfault.tristatelogic.com 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Tue Aug 5 02:38:40 PDT 2008 root@segfault.monkeys.com:/usr/src/sys/i386/compile/rfg20080805 i386 >Description: script.c does pointless zero-length writes to its child (shell) process. Also, an EOF on stdin should probably terminate everything. >How-To-Repeat: Look at the code. >Fix: *** script.c.orig 2004-02-15 09:30:13.000000000 -0800 --- script.c 2010-11-10 21:49:21.000000000 -0800 *************** *** 179,186 **** if (n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) { cc = read(STDIN_FILENO, ibuf, BUFSIZ); ! if (cc < 0) break; - if (cc == 0) - (void)write(master, ibuf, 0); if (cc > 0) { (void)write(master, ibuf, cc); --- 179,184 ---- if (n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) { cc = read(STDIN_FILENO, ibuf, BUFSIZ); ! if (cc <= 0) break; if (cc > 0) { (void)write(master, ibuf, cc); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101111055415.20E8BBDC35>