From 5645b4c307c4d455977b65f8d08ea71fc02fdcad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 17 Feb 2015 03:57:17 +0100 Subject: [PATCH] qrexec: wait for remote exit code, even when both stdin/out are closed --- qrexec/qrexec-client.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/qrexec/qrexec-client.c b/qrexec/qrexec-client.c index d3a4560..45b27c5 100644 --- a/qrexec/qrexec-client.c +++ b/qrexec/qrexec-client.c @@ -286,13 +286,16 @@ static void handle_input(libvchan_t *vchan) close(local_stdout_fd); local_stdout_fd = -1; if (local_stdin_fd == -1) { - // if pipe in opposite direction already closed, no need to stay alive - if (is_service && local_pid == 0) { - /* if this is "remote" service end and no real local process - * exists (using own stdin/out) send also fake exit code */ - send_exit_code(vchan, 0); + // if not a remote end of service call, wait for exit status + if (is_service) { + // if pipe in opposite direction already closed, no need to stay alive + if (local_pid == 0) { + /* if this is "remote" service end and no real local process + * exists (using own stdin/out) send also fake exit code */ + send_exit_code(vchan, 0); + } + do_exit(0); } - do_exit(0); } } if (!write_vchan_all(vchan, buf, ret)) {