Introduction
Introduction Statistics Contact Development Disclaimer Help
tcmd: read until EOF if POLLIN and POLLERR are returned from poll() - neatvi - …
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 13b5534f46724cc6200c0aeb36800c5f3b33801e
parent 29b4fa028ebed5c2b2a9a7e13bce07ab2ae81587
Author: Ali Gholami Rudi <[email protected]>
Date: Wed, 13 Jan 2021 20:57:55 +0330
cmd: read until EOF if POLLIN and POLLERR are returned from poll()
Diffstat:
M cmd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/cmd.c b/cmd.c
t@@ -82,8 +82,9 @@ char *cmd_pipe(char *cmd, char *ibuf, int iproc, int oproc)
int ret = read(fds[0].fd, buf, sizeof(buf));
if (ret > 0)
sbuf_mem(sb, buf, ret);
- if (ret < 0)
+ if (ret <= 0)
close(fds[0].fd);
+ continue;
}
if (fds[1].revents & POLLOUT) {
int ret = write(fds[1].fd, ibuf + nw, slen - nw);
t@@ -91,6 +92,7 @@ char *cmd_pipe(char *cmd, char *ibuf, int iproc, int oproc)
nw += ret;
if (ret <= 0 || nw == slen)
close(fds[1].fd);
+ continue;
}
if (fds[2].revents & POLLIN) {
int ret = read(fds[2].fd, buf, sizeof(buf));
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.