summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-17 16:21:18 -0500
committerNathan Straz <nstraz@redhat.com>2013-09-17 18:04:38 -0400
commit42a431da0abe614a7efa03164430918e55f35609 (patch)
tree707aeedbf8ce643f58fc15fe943d2906756bb431
parent20407605a41f191811c35b018c81ed048fc8daa2 (diff)
downloadqarsh-42a431da0abe614a7efa03164430918e55f35609.zip
qarsh-42a431da0abe614a7efa03164430918e55f35609.tar.gz
qarsh-42a431da0abe614a7efa03164430918e55f35609.tar.xz
Don't block writing to child's stdin
-rw-r--r--qarshd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qarshd.c b/qarshd.c
index 8d1a798..daead85 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -103,7 +103,7 @@ run_cmd(const char *cmd)
pid_t pid;
int pipefds[2], parentfds[3];
- pipe(pipefds);
+ pipe2(pipefds, O_NONBLOCK);
childfds[0] = pipefds[1]; parentfds[0] = pipefds[0]; /* stdin */
pipe(pipefds);
childfds[1] = pipefds[0]; parentfds[1] = pipefds[1]; /* stdout */
@@ -412,7 +412,7 @@ handle_qarsh()
memmove(buf_in, buf_in+nbytes, z_in - nbytes);
z_in -= nbytes;
}
- if (!eof_in) {
+ if (!eof_in && nbytes > 0) {
qp = make_qp_data_allow(0, nbytes);
send_packet(qoutfd, qp);
qpfree(qp);