summaryrefslogtreecommitdiffstats
path: root/qarsh.c
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-19 17:22:03 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-19 17:22:03 -0400
commit2da3d279e360bfb4ac470874d4b43b765b6596fa (patch)
treeb712cb32baf01eddfa4bba8c3a090817aa6c38eb /qarsh.c
parentfe8b924760c9ad8b81100a195f29b9c0eff54736 (diff)
downloadqarsh-2da3d279e360bfb4ac470874d4b43b765b6596fa.tar.gz
qarsh-2da3d279e360bfb4ac470874d4b43b765b6596fa.tar.xz
qarsh-2da3d279e360bfb4ac470874d4b43b765b6596fa.zip
Handle stdin pipe closing on us
If xiogen is flooding requests across qarsh and xdoio decides to stop, we need to handle that gracefully. Also, making the pipe non-blocking was not a good idea, xdoio gets the read error EAGAIN and stops there.
Diffstat (limited to 'qarsh.c')
-rw-r--r--qarsh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/qarsh.c b/qarsh.c
index 51a876b..2683591 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -395,6 +395,12 @@ run_remote_cmd(char *cmdline)
fprintf(stderr, "ERROR: Received data allow for fd %d\n",
qp->qp_dallow.qp_remfd);
}
+ } else if (qp->qp_type == QP_RETURNCODE) { /* qarshd hit an error while writing to stdin */
+ fprintf(stderr, "Remote command hit I/O error: %s\n", qp->qp_returncode.qp_strerror);
+ close(fileno(stdin));
+ allowed_in = -1;
+ } else {
+ fprintf(stderr, "Unexpected packet type %s\n", qp_packet_type(qp->qp_type));
}
qpfree(qp);
nset--;