server: Always create fd for console_input object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-07-06 19:25:50 +02:00 committed by Alexandre Julliard
parent 5376bc5ee4
commit e5493e34e4
1 changed files with 14 additions and 12 deletions

View File

@ -258,10 +258,7 @@ static struct fd *console_input_get_fd( struct object* obj )
{
struct console_input *console_input = (struct console_input*)obj;
assert( obj->ops == &console_input_ops );
if (console_input->fd)
return (struct fd *)grab_object( console_input->fd );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return NULL;
}
static enum server_fd_type console_get_fd_type( struct fd *fd )
@ -400,15 +397,20 @@ static struct object *create_console_input( struct thread* renderer, int fd )
}
if (fd != -1) /* bare console */
{
if (!(console_input->fd = create_anonymous_fd( &console_fd_ops, fd, &console_input->obj,
FILE_SYNCHRONOUS_IO_NONALERT )))
console_input->fd = create_anonymous_fd( &console_fd_ops, fd, &console_input->obj,
FILE_SYNCHRONOUS_IO_NONALERT );
}
else
{
console_input->fd = alloc_pseudo_fd( &console_fd_ops, &console_input->obj,
FILE_SYNCHRONOUS_IO_NONALERT );
}
if (!console_input->fd)
{
release_object( console_input );
return NULL;
}
allow_fd_caching( console_input->fd );
}
return &console_input->obj;
}