Jacek Caban : server: Always create fd for console_input object.

Alexandre Julliard julliard at winehq.org
Mon Jul 6 16:20:46 CDT 2020


Module: wine
Branch: master
Commit: e5493e34e4a0c21771200b0ecb72b7c24c484f39
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e5493e34e4a0c21771200b0ecb72b7c24c484f39

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jul  6 19:25:50 2020 +0200

server: Always create fd for console_input object.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/console.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/server/console.c b/server/console.c
index 729cfa4061..fc12a3a8f3 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;
 }
 




More information about the wine-cvs mailing list