summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-02-07 09:25:31 -0500
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-02-07 09:25:31 -0500
commit5dff14fdf59d47d96a11fd94e43b964801b0211d (patch)
tree22dc4c34c0a72115ee711fb692d7faced89d9005
parent8df8e8c2f4cca9d1b6682ca2e4c2bbb86fc91a29 (diff)
Fix possible deadlock in node-select
-rw-r--r--vchan/node-select.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vchan/node-select.c b/vchan/node-select.c
index f6b2d7f..eb5fd8b 100644
--- a/vchan/node-select.c
+++ b/vchan/node-select.c
@@ -124,14 +124,14 @@ int main(int argc, char **argv)
libvchan_wait(ctrl);
vchan_wr();
}
- while (libvchan_data_ready(ctrl)) {
+ if (FD_ISSET(1, &wfds))
+ stdout_wr();
+ while (libvchan_data_ready(ctrl) && outsiz < BUFSIZE) {
ret = libvchan_read(ctrl, outbuf + outsiz, BUFSIZE - outsiz);
if (ret < 0)
exit(1);
outsiz += ret;
stdout_wr();
}
- if (FD_ISSET(1, &wfds))
- stdout_wr();
}
}