diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index d8ccdd1905e..b312831dd6d 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -1301,7 +1301,7 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state) buf, 1, buf+1, 1); if (!status || status == STATUS_PENDING) status = io.Status; - todo_wine + todo_wine_if(expected_status == STATUS_PIPE_DISCONNECTED) ok(status == expected_status, "NtFsControlFile(FSCTL_PIPE_TRANSCEIVE) failed in %s state %u: %x\n", is_server ? "server" : "client", state, status); diff --git a/server/named_pipe.c b/server/named_pipe.c index 0806d99985c..f7b8b544a4b 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -937,6 +937,12 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) struct pipe_message *message; struct iosb *iosb; + if (!pipe_end->connection) + { + set_error( STATUS_INVALID_PIPE_STATE ); + return 0; + } + if ((pipe_end->flags & (NAMED_PIPE_MESSAGE_STREAM_WRITE | NAMED_PIPE_MESSAGE_STREAM_READ)) != (NAMED_PIPE_MESSAGE_STREAM_WRITE | NAMED_PIPE_MESSAGE_STREAM_READ)) { @@ -944,12 +950,6 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) return 0; } - if (!pipe_end->connection) - { - set_error( STATUS_PIPE_BROKEN ); - return 0; - } - /* not allowed if we already have read data buffered */ if (!list_empty( &pipe_end->message_queue )) {