Commit 7a344c14 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Avoid a crash when trying to wait on a disconnected pipe client.

parent d88f9e3c
......@@ -1710,6 +1710,12 @@ void set_fd_signaled( struct fd *fd, int signaled )
if (signaled) wake_up( fd->user, 0 );
}
/* set or clear the fd signaled state */
int is_fd_signaled( struct fd *fd )
{
return fd->signaled;
}
/* handler for close_handle that refuses to close fd-associated handles in other processes */
int fd_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
{
......
......@@ -70,6 +70,7 @@ extern void set_fd_events( struct fd *fd, int events );
extern obj_handle_t lock_fd( struct fd *fd, file_pos_t offset, file_pos_t count, int shared, int wait );
extern void unlock_fd( struct fd *fd, file_pos_t offset, file_pos_t count );
extern void set_fd_signaled( struct fd *fd, int signaled );
extern int is_fd_signaled( struct fd *fd );
extern int default_fd_signaled( struct object *obj, struct thread *thread );
extern unsigned int default_fd_map_access( struct object *obj, unsigned int access );
......
......@@ -176,6 +176,7 @@ static const struct fd_ops pipe_server_fd_ops =
/* client end functions */
static void pipe_client_dump( struct object *obj, int verbose );
static int pipe_client_signaled( struct object *obj, struct thread *thread );
static struct fd *pipe_client_get_fd( struct object *obj );
static void pipe_client_destroy( struct object *obj );
static void pipe_client_flush( struct fd *fd, struct event **event );
......@@ -188,7 +189,7 @@ static const struct object_ops pipe_client_ops =
no_get_type, /* get_type */
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
pipe_client_signaled, /* signaled */
no_satisfied, /* satisfied */
no_signal, /* signal */
pipe_client_get_fd, /* get_fd */
......@@ -289,6 +290,13 @@ static void pipe_client_dump( struct object *obj, int verbose )
fprintf( stderr, "Named pipe client server=%p\n", client->server );
}
static int pipe_client_signaled( struct object *obj, struct thread *thread )
{
struct pipe_client *client = (struct pipe_client *) obj;
return client->fd && is_fd_signaled(client->fd);
}
static void named_pipe_destroy( struct object *obj)
{
struct named_pipe *pipe = (struct named_pipe *) obj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment