qrexec: wait for remote exit code, even when both stdin/out are closed

This commit is contained in:
Marek Marczykowski-Górecki 2015-02-17 03:57:17 +01:00
parent 61eb2e7764
commit 5645b4c307

View File

@ -286,8 +286,10 @@ static void handle_input(libvchan_t *vchan)
close(local_stdout_fd); close(local_stdout_fd);
local_stdout_fd = -1; local_stdout_fd = -1;
if (local_stdin_fd == -1) { if (local_stdin_fd == -1) {
// 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 pipe in opposite direction already closed, no need to stay alive
if (is_service && local_pid == 0) { if (local_pid == 0) {
/* if this is "remote" service end and no real local process /* if this is "remote" service end and no real local process
* exists (using own stdin/out) send also fake exit code */ * exists (using own stdin/out) send also fake exit code */
send_exit_code(vchan, 0); send_exit_code(vchan, 0);
@ -295,6 +297,7 @@ static void handle_input(libvchan_t *vchan)
do_exit(0); do_exit(0);
} }
} }
}
if (!write_vchan_all(vchan, buf, ret)) { if (!write_vchan_all(vchan, buf, ret)) {
if (!libvchan_is_open(vchan)) { if (!libvchan_is_open(vchan)) {
// agent disconnected its end of socket, so no future data will be // agent disconnected its end of socket, so no future data will be