about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-03-26 18:55:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-03-26 18:55:22 +0000
commit2941469f616202f51da7ba9ceafa3f419f34573b (patch)
tree17c7a362c2f0e76b6a83be3a75c65a2dc6a5fcf9
parent244f2a14fc2c0b9a57d782a290d17bc1a4299600 (diff)
downloadzsh-2941469f616202f51da7ba9ceafa3f419f34573b.tar.gz
zsh-2941469f616202f51da7ba9ceafa3f419f34573b.tar.xz
zsh-2941469f616202f51da7ba9ceafa3f419f34573b.zip
18392: read with -p and -t and no coprocess crashed.
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fa8c98257..c0de1ae7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-26  Peter Stephenson  <pws@csr.com>
+
+	* 18392: Src/builtin.c: read with -p and -t options crashed
+	if no coprocess owing to bad file descriptor.
+
 2003-03-26  Oliver Kiddle  <opk@zsh.org>
 
 	* 18391: Test/.distfiles, Test/B03print.ztst, Test/B04read.ztst,
diff --git a/Src/builtin.c b/Src/builtin.c
index 3c07ee59a..4750e8d8b 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4212,7 +4212,8 @@ bin_read(char *name, char **args, Options ops, int func)
 		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)
 		settyinfo(&shttyinfo);
 	    if (haso) {