From 55e040cbefa43e71c5c1d63e2cdae2e74569a6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 16 Mar 2015 21:39:34 +0100 Subject: [PATCH] qrexec: do not break connection on duplicated SIGUSR1 Child process can request to use single socket for both stdin and stdout by sending SIGUSR1 signal. If it does so twice or more, previous code broke the connection by closing the socket. --- qrexec/qrexec-agent-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qrexec/qrexec-agent-data.c b/qrexec/qrexec-agent-data.c index ae5057e..fe9b57f 100644 --- a/qrexec/qrexec-agent-data.c +++ b/qrexec/qrexec-agent-data.c @@ -313,7 +313,7 @@ int process_child_io(libvchan_t *data_vchan, } /* child signaled desire to use single socket for both stdin and stdout */ if (stdio_socket_requested) { - if (stdout_fd != -1) + if (stdout_fd != -1 && stdout_fd != stdin_fd) close(stdout_fd); stdout_fd = stdin_fd; stdio_socket_requested = 0;