server: Improve named pipe read error handling.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0973b8d2c3
commit
91852564dc
|
@ -1338,7 +1338,6 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state)
|
|||
break;
|
||||
}
|
||||
status = NtReadFile(pipe, NULL, NULL, NULL, &io, buf, 1, NULL, NULL);
|
||||
todo_wine_if(state == FILE_PIPE_DISCONNECTED_STATE && !is_server)
|
||||
ok(status == expected_status, "NtReadFile failed in %s state %u: %x\n",
|
||||
is_server ? "server" : "client", state, status);
|
||||
}
|
||||
|
@ -1427,7 +1426,6 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
|
|||
if (state == FILE_PIPE_CLOSING_STATE)
|
||||
expected_status = STATUS_SUCCESS;
|
||||
status = NtReadFile(pipe, NULL, NULL, NULL, &io, buf, 1, NULL, NULL);
|
||||
todo_wine_if(state == FILE_PIPE_DISCONNECTED_STATE && status != STATUS_PIPE_DISCONNECTED)
|
||||
ok(status == expected_status, "NtReadFile failed in %s state %u: %x\n",
|
||||
is_server ? "server" : "client", state, status);
|
||||
}
|
||||
|
|
|
@ -798,8 +798,18 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos )
|
|||
{
|
||||
struct pipe_end *pipe_end = get_fd_user( fd );
|
||||
|
||||
if (!pipe_end->connection && list_empty( &pipe_end->message_queue ))
|
||||
switch (pipe_end->state)
|
||||
{
|
||||
case FILE_PIPE_CONNECTED_STATE:
|
||||
break;
|
||||
case FILE_PIPE_DISCONNECTED_STATE:
|
||||
set_error( STATUS_PIPE_DISCONNECTED );
|
||||
return 0;
|
||||
case FILE_PIPE_LISTENING_STATE:
|
||||
set_error( STATUS_PIPE_LISTENING );
|
||||
return 0;
|
||||
case FILE_PIPE_CLOSING_STATE:
|
||||
if (!list_empty( &pipe_end->message_queue )) break;
|
||||
set_error( STATUS_PIPE_BROKEN );
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue