diff --git a/daemon/qrexec-client.c b/daemon/qrexec-client.c index 0c89a5c5..41bc7dfa 100644 --- a/daemon/qrexec-client.c +++ b/daemon/qrexec-client.c @@ -345,6 +345,9 @@ int main(int argc, char **argv) wait_connection_end, use_uuid) ? 0 : 137; } else { s = connect_unix_socket(domname); + if (s < 0) { + goto cleanup; + } if (!negotiate_connection_params(s, src_domain_id, just_exec ? MSG_JUST_EXEC : MSG_EXEC_CMDLINE, diff --git a/daemon/qrexec-daemon-common.c b/daemon/qrexec-daemon-common.c index 2e8852dc..b2f3d29f 100644 --- a/daemon/qrexec-daemon-common.c +++ b/daemon/qrexec-daemon-common.c @@ -206,8 +206,13 @@ bool qrexec_execute_vm(const char *target, bool autostart, int remote_domain_id, } s = connect_unix_socket_by_id((unsigned)remote_domain_id); - rc = send_service_connect(s, request_id, data_domain, data_port); - close(s); + if (s < 0) { + rc = false; + } else { + rc = send_service_connect(s, request_id, data_domain, data_port); + close(s); + } + if (wait_connection_end) { /* wait for EOF */ struct pollfd fds[1] = {