summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Modules/zpty.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a1085bd23..8a72064bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,12 @@
 	allows you to make the right prompt flush if your terminal
 	supports it.
 
+2013-12-16  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* Jun Takimoto + Bart: 32131: Src/Modules/zpty.c: avoid infinite
+	loop reading pseudo-terminal on platforms that do not buffer pty
+	contents after child process exits
+
 2013-12-15  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* users/18219: Completion/Zsh/Type/_command_names: compadd -Q for
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index fca0cc172..d119658c3 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -510,14 +510,14 @@ checkptycmd(Ptycmd cmd)
 
     if (cmd->read != -1 || cmd->fin)
 	return;
-    if ((r = read(cmd->fd, &c, 1)) < 0) {
+    if ((r = read(cmd->fd, &c, 1)) <= 0) {
 	if (kill(cmd->pid, 0) < 0) {
 	    cmd->fin = 1;
 	    zclose(cmd->fd);
 	}
 	return;
     }
-    if (r) cmd->read = (int) c;
+    cmd->read = (int) c;
 }
 
 static int