From eede817da236f4ecdf882ca60cfd607c2e4ed9e1 Mon Sep 17 00:00:00 2001 From: Paul Rupe Date: Fri, 11 Jul 2003 21:44:17 +0000 Subject: [PATCH] register_new_async sets status already. Do not overwrite it with the function's return value. --- dlls/ntdll/file.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 46916016949..9e6daf3c22b 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -375,6 +375,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, if (flags & (FD_FLAG_OVERLAPPED|FD_FLAG_TIMEOUT)) { async_fileio* ovp; + NTSTATUS ret; if (unix_handle < 0) return STATUS_INVALID_HANDLE; @@ -397,12 +398,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, ovp->fd_type = type; io_status->Information = 0; - io_status->u.Status = register_new_async(&ovp->async); - if (io_status->u.Status == STATUS_PENDING && hEvent) - { - finish_async(&ovp->async); - close(unix_handle); - } + ret = register_new_async(&ovp->async); + if (ret != STATUS_SUCCESS) + return ret; return io_status->u.Status; } switch (type) @@ -531,6 +529,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, if (flags & (FD_FLAG_OVERLAPPED|FD_FLAG_TIMEOUT)) { async_fileio* ovp; + NTSTATUS ret; if (unix_handle < 0) return STATUS_INVALID_HANDLE; @@ -553,12 +552,9 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, ovp->fd_type = type; io_status->Information = 0; - io_status->u.Status = register_new_async(&ovp->async); - if (io_status->u.Status == STATUS_PENDING && hEvent) - { - finish_async(&ovp->async); - close(unix_handle); - } + ret = register_new_async(&ovp->async); + if (ret != STATUS_SUCCESS) + return ret; return io_status->u.Status; } switch (type)