diff --git a/qrexec/qrexec-client.c b/qrexec/qrexec-client.c index 45b27c5..24e1ba4 100644 --- a/qrexec/qrexec-client.c +++ b/qrexec/qrexec-client.c @@ -410,6 +410,7 @@ static void select_loop(libvchan_t *vchan) int vchan_fd; sigset_t selectmask; struct timespec zero_timeout = { 0, 0 }; + struct timespec select_timeout = { 10, 0 }; sigemptyset(&selectmask); sigaddset(&selectmask, SIGCHLD); @@ -434,7 +435,7 @@ static void select_loop(libvchan_t *vchan) &zero_timeout, &selectmask); } else ret = pselect(max_fd + 1, &select_set, NULL, NULL, - NULL, &selectmask); + &select_timeout, &selectmask); if (ret < 0) { if (errno == EINTR && local_pid > 0) { continue; @@ -443,6 +444,12 @@ static void select_loop(libvchan_t *vchan) do_exit(1); } } + if (ret == 0) { + if (!libvchan_is_open(vchan)) { + /* remote disconnected witout a proper signaling */ + do_exit(1); + } + } if (FD_ISSET(vchan_fd, &select_set)) libvchan_wait(vchan); while (libvchan_data_ready(vchan))