Module: wine Branch: master Commit: 04607ca6320289b64fa7dc7abd67ff5a45141ff4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=04607ca6320289b64fa7dc7abd...
Author: Eric Pouech eric.pouech@orange.fr Date: Tue Sep 21 22:09:06 2010 +0200
server: Fix console creation logic.
---
server/console.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/server/console.c b/server/console.c index d256ae8..4441163 100644 --- a/server/console.c +++ b/server/console.c @@ -1386,6 +1386,7 @@ DECL_HANDLER(alloc_console) struct thread *renderer; struct console_input *console; int fd; + int attach = 0;
switch (req->pid) { @@ -1398,12 +1399,14 @@ DECL_HANDLER(alloc_console) return; } grab_object( process ); + attach = 1; break; case 0xffffffff: /* no renderer, console to be attached to current process */ renderer = NULL; process = current->process; grab_object( process ); + attach = 1; break; default: /* renderer is current, console to be attached to req->pid */ @@ -1411,7 +1414,7 @@ DECL_HANDLER(alloc_console) if (!(process = get_process_from_id( req->pid ))) return; }
- if (process != current->process && process->console) + if (attach && process->console) { set_error( STATUS_ACCESS_DENIED ); goto the_end; @@ -1433,8 +1436,11 @@ DECL_HANDLER(alloc_console) if (!console->evt || (evt = alloc_handle( current->process, console->evt, SYNCHRONIZE|GENERIC_READ|GENERIC_WRITE, 0 ))) { - process->console = (struct console_input*)grab_object( console ); - console->num_proc++; + if (attach) + { + process->console = (struct console_input*)grab_object( console ); + console->num_proc++; + } reply->handle_in = in; reply->event = evt; release_object( console );