Commit 04607ca6 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

server: Fix console creation logic.

parent f870cf07
...@@ -1386,6 +1386,7 @@ DECL_HANDLER(alloc_console) ...@@ -1386,6 +1386,7 @@ DECL_HANDLER(alloc_console)
struct thread *renderer; struct thread *renderer;
struct console_input *console; struct console_input *console;
int fd; int fd;
int attach = 0;
switch (req->pid) switch (req->pid)
{ {
...@@ -1398,12 +1399,14 @@ DECL_HANDLER(alloc_console) ...@@ -1398,12 +1399,14 @@ DECL_HANDLER(alloc_console)
return; return;
} }
grab_object( process ); grab_object( process );
attach = 1;
break; break;
case 0xffffffff: case 0xffffffff:
/* no renderer, console to be attached to current process */ /* no renderer, console to be attached to current process */
renderer = NULL; renderer = NULL;
process = current->process; process = current->process;
grab_object( process ); grab_object( process );
attach = 1;
break; break;
default: default:
/* renderer is current, console to be attached to req->pid */ /* renderer is current, console to be attached to req->pid */
...@@ -1411,7 +1414,7 @@ DECL_HANDLER(alloc_console) ...@@ -1411,7 +1414,7 @@ DECL_HANDLER(alloc_console)
if (!(process = get_process_from_id( req->pid ))) return; if (!(process = get_process_from_id( req->pid ))) return;
} }
if (process != current->process && process->console) if (attach && process->console)
{ {
set_error( STATUS_ACCESS_DENIED ); set_error( STATUS_ACCESS_DENIED );
goto the_end; goto the_end;
...@@ -1433,8 +1436,11 @@ DECL_HANDLER(alloc_console) ...@@ -1433,8 +1436,11 @@ DECL_HANDLER(alloc_console)
if (!console->evt || if (!console->evt ||
(evt = alloc_handle( current->process, console->evt, SYNCHRONIZE|GENERIC_READ|GENERIC_WRITE, 0 ))) (evt = alloc_handle( current->process, console->evt, SYNCHRONIZE|GENERIC_READ|GENERIC_WRITE, 0 )))
{ {
if (attach)
{
process->console = (struct console_input*)grab_object( console ); process->console = (struct console_input*)grab_object( console );
console->num_proc++; console->num_proc++;
}
reply->handle_in = in; reply->handle_in = in;
reply->event = evt; reply->event = evt;
release_object( console ); release_object( console );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment