[PATCH 1/2] server/console: when a Unix process group leader terminates, disconnect the console
Jacek Caban
jacek at codeweavers.com
Mon Dec 13 15:04:22 CST 2021
Hi Eric,
On 12/9/21 12:16 PM, Eric Pouech wrote:
> Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
>
> ---
> server/console.c | 13 +++++++++++++
> server/process.c | 1 +
> server/process.h | 1 +
> 3 files changed, 15 insertions(+)
>
> diff --git a/server/console.c b/server/console.c
> index b4ef1d21874..15652cbe0b9 100644
> --- a/server/console.c
> +++ b/server/console.c
> @@ -1584,3 +1584,16 @@ DECL_HANDLER(get_next_console_request)
>
> release_object( server );
> }
> +
> +void console_notify_kill( struct process *process )
> +{
> + struct console_server* server;
> + if (!process->console) return;
> + server = process->console->server;
> + /* If the terminating process is a process group leader (in Unix world),
> + * and is attached to a pty, we need to disconnect the server (as the controling
> + * terminal is no longer accessible).
> + */
> + if (server && server->term_fd != -1 && getpgid( process->unix_pid ) == process->unix_pid)
> + disconnect_console_server( server );
This check may not be enough in corner cases. The process can attach to
a different process' console in Windows sense, but it will still be a
process group leader of a group in Unix sense. Also, I think that only
input and tcsetattr may be a problem later, output should still work. Do
we need do disconnect entire console?
Thanks,
Jacek
More information about the wine-devel
mailing list