Commit 9aad600d authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

server: Always remove inflight fd if alloc_console fails.

parent d00e8ebd
......@@ -1392,6 +1392,16 @@ DECL_HANDLER(alloc_console)
int fd;
int attach = 0;
if (req->input_fd != -1)
{
if ((fd = thread_get_inflight_fd( current, req->input_fd )) == -1)
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
}
else fd = -1;
switch (req->pid)
{
case 0:
......@@ -1399,6 +1409,7 @@ DECL_HANDLER(alloc_console)
renderer = current;
if (!(process = current->process->parent))
{
if (fd != -1) close( fd );
set_error( STATUS_ACCESS_DENIED );
return;
}
......@@ -1415,23 +1426,19 @@ DECL_HANDLER(alloc_console)
default:
/* renderer is current, console to be attached to req->pid */
renderer = current;
if (!(process = get_process_from_id( req->pid ))) return;
if (!(process = get_process_from_id( req->pid )))
{
if (fd != -1) close( fd );
return;
}
}
if (attach && process->console)
{
if (fd != -1) close( fd );
set_error( STATUS_ACCESS_DENIED );
goto the_end;
}
if (req->input_fd != -1)
{
if ((fd = thread_get_inflight_fd( current, req->input_fd )) == -1)
{
set_error( STATUS_INVALID_PARAMETER );
goto the_end;
}
}
else fd = -1;
if ((console = (struct console_input*)create_console_input( renderer, fd )))
{
......
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