bin/152131: Useless code in script.c (part 1)
Ronald F.Guilmette
rfg at tristatelogic.com
Thu Nov 11 06:00:23 UTC 2010
>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 at 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:
More information about the freebsd-bugs
mailing list