diff --git a/server/fd.c b/server/fd.c index 7417dee8aea..191d126bce7 100644 --- a/server/fd.c +++ b/server/fd.c @@ -987,7 +987,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl if ((obj = get_handle_obj( process, handle, access, NULL ))) { - if (!(fd = get_obj_fd( obj ))) set_error( STATUS_OBJECT_TYPE_MISMATCH ); + fd = get_obj_fd( obj ); release_object( obj ); } return fd; diff --git a/server/named_pipe.c b/server/named_pipe.c index 984c575d0ba..780fcc69a1b 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -163,7 +163,9 @@ static void notify_waiter( struct pipe_user *user, unsigned int status) static struct fd *pipe_user_get_fd( struct object *obj ) { struct pipe_user *user = (struct pipe_user *)obj; - return (struct fd *)grab_object( user->fd ); + if (user->fd) return (struct fd *)grab_object( user->fd ); + set_error( STATUS_PIPE_DISCONNECTED ); + return NULL; } static void pipe_user_destroy( struct object *obj)