Commit 91852564 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Improve named pipe read error handling.

parent 0973b8d2
......@@ -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;
}
......
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