From feae6af6d2429afdfd8b2048f7a80b716840cffe Mon Sep 17 00:00:00 2001 From: Jun T Date: Mon, 16 Dec 2013 22:15:08 -0800 Subject: 32131: avoid infinite loop reading pty on platforms that do not buffer output after child exit --- Src/Modules/zpty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Src/Modules') 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 -- cgit 1.4.1