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.
This commit is contained in:
Marek Marczykowski-Górecki 2015-03-16 21:39:34 +01:00
parent 23fc3599e8
commit 55e040cbef

View File

@ -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;