Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in read builtin and Re: PATCH: extra loop tests

Oliver Kiddle wrote:
> In adding tests for read (to cover the
> new read -d), I found that read -t 1 -p causes a seg fault:

I think this test needs to be in other places, but the logic in
bin_read() is a bit tortuous.

Index: Src/builtin.c
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.97
diff -u -r1.97 builtin.c
--- Src/builtin.c	17 Feb 2003 10:08:03 -0000	1.97
+++ Src/builtin.c	26 Mar 2003 17:50:28 -0000
@@ -4212,7 +4212,8 @@
 		timeout = (zlong)mn.u.l * (zlong)1000000;
-	if (!read_poll(readfd, &readchar, keys && !zleactive, timeout)) {
+	if (readfd == -1 ||
+	    !read_poll(readfd, &readchar, keys && !zleactive, timeout)) {
 	    if (OPT_ISSET(ops,'k') && !zleactive && !isem)
 	    if (haso) {

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

Messages sorted by: Reverse Date, Date, Thread, Author