about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorJun T <takimoto-j@kba.biglobe.ne.jp>2013-12-16 22:15:08 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2013-12-16 22:15:08 -0800
commitfeae6af6d2429afdfd8b2048f7a80b716840cffe (patch)
tree04984e11352b111319a1b76ee25710f30cc772bf /Src/Modules
parentdb23c630051fe330782cda4089a16de7ec579f29 (diff)
downloadzsh-feae6af6d2429afdfd8b2048f7a80b716840cffe.tar.gz
zsh-feae6af6d2429afdfd8b2048f7a80b716840cffe.tar.xz
zsh-feae6af6d2429afdfd8b2048f7a80b716840cffe.zip
32131: avoid infinite loop reading pty on platforms that do not buffer output after child exit
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/zpty.c4
1 files changed, 2 insertions, 2 deletions
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