Eric Pouech : server: Ensure we set proper errors when getting a NULL fd out of a handle.
Alexandre Julliard
julliard at winehq.org
Sat Sep 18 07:42:19 CDT 2010
Module: wine
Branch: master
Commit: 687b3dc25c4dd0efefcc53c8c07fa52a833b1a76
URL: http://source.winehq.org/git/wine.git/?a=commit;h=687b3dc25c4dd0efefcc53c8c07fa52a833b1a76
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Thu Sep 16 21:05:26 2010 +0200
server: Ensure we set proper errors when getting a NULL fd out of a handle.
---
server/console.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/server/console.c b/server/console.c
index 6616bd2..957e35f 100644
--- a/server/console.c
+++ b/server/console.c
@@ -193,7 +193,10 @@ 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 );
- return console_input->fd ? (struct fd*)grab_object( console_input->fd ) : NULL;
+ 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 )
@@ -1144,7 +1147,10 @@ static struct fd *screen_buffer_get_fd( struct object *obj )
{
struct screen_buffer *screen_buffer = (struct screen_buffer*)obj;
assert( obj->ops == &screen_buffer_ops );
- return screen_buffer->fd ? (struct fd*)grab_object( screen_buffer->fd ) : NULL;
+ if (screen_buffer->fd)
+ return (struct fd*)grab_object( screen_buffer->fd );
+ set_error( STATUS_OBJECT_TYPE_MISMATCH );
+ return NULL;
}
/* write data into a screen buffer */
More information about the wine-cvs
mailing list