summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);