Signed-off-by: Eric Pouech eric.pouech@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 ); +} diff --git a/server/process.c b/server/process.c index 6d794ba5ead..8538bd89df6 100644 --- a/server/process.c +++ b/server/process.c @@ -972,6 +972,7 @@ static void process_killed( struct process *process )
assert( list_empty( &process->thread_list )); process->end_time = current_time; + console_notify_kill( process ); close_process_desktop( process ); process->winstation = 0; process->desktop = 0; diff --git a/server/process.h b/server/process.h index 22ee8178368..2eb0491261e 100644 --- a/server/process.h +++ b/server/process.h @@ -121,6 +121,7 @@ extern void enum_processes( int (*cb)(struct process*, void*), void *user);
/* console functions */ extern struct thread *console_get_renderer( struct console *console ); +extern void console_notify_kill( struct process *process );
/* process tracing mechanism to use */ #ifdef __APPLE__