server: Fix console creation logic.
This commit is contained in:
parent
f870cf07e8
commit
04607ca632
|
@ -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)
|
||||||
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)
|
||||||
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)
|
||||||
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 )))
|
||||||
{
|
{
|
||||||
process->console = (struct console_input*)grab_object( console );
|
if (attach)
|
||||||
console->num_proc++;
|
{
|
||||||
|
process->console = (struct console_input*)grab_object( console );
|
||||||
|
console->num_proc++;
|
||||||
|
}
|
||||||
reply->handle_in = in;
|
reply->handle_in = in;
|
||||||
reply->event = evt;
|
reply->event = evt;
|
||||||
release_object( console );
|
release_object( console );
|
||||||
|
|
Loading…
Reference in New Issue