diff --git a/server/console.c b/server/console.c index 729cfa40612..fc12a3a8f36 100644 --- a/server/console.c +++ b/server/console.c @@ -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; + return (struct fd *)grab_object( console_input->fd ); } 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 ))) - { - release_object( console_input ); - return NULL; - } - allow_fd_caching( console_input->fd ); + 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; }