[Midnightbsd-cvs] src: usr.bin/script: When script(1) reads EOF from input it starts

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Oct 4 23:52:10 EDT 2011


Log Message:
-----------
When script(1) reads EOF from input it starts spinning on zero-byte
reads eating 100% CPU. Fix this by skipping select on STDIN after
reading EOF -- permanently if STDIN is not terminal and for one second
if it is.

Also after reading EOF from STDIN we have to pass it to the program
being scripted. The previous approach was to write zero bytes into the
pseudo-terminal. This does not work because zero-byte write does not
have any effect on read. Fix this by sending VEOF instead.

Obtained from: freebsd

Modified Files:
--------------
    src/usr.bin/script:
        script.1 (r1.1.1.1 -> r1.2)
        (http://cvsweb.midnightbsd.org/src/usr.bin/script/script.1?r1=1.1.1.1&r2=1.2)
        script.c (r1.1.1.1 -> r1.2)
        (http://cvsweb.midnightbsd.org/src/usr.bin/script/script.c?r1=1.1.1.1&r2=1.2)


More information about the Midnightbsd-cvs mailing list