diff options
author | Nathan Straz <nstraz@redhat.com> | 2013-09-17 16:21:18 -0500 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2013-09-17 18:04:38 -0400 |
commit | 42a431da0abe614a7efa03164430918e55f35609 (patch) | |
tree | 707aeedbf8ce643f58fc15fe943d2906756bb431 | |
parent | 20407605a41f191811c35b018c81ed048fc8daa2 (diff) | |
download | qarsh-42a431da0abe614a7efa03164430918e55f35609.tar.gz qarsh-42a431da0abe614a7efa03164430918e55f35609.tar.xz qarsh-42a431da0abe614a7efa03164430918e55f35609.zip |
Don't block writing to child's stdin
-rw-r--r-- | qarshd.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |