[2/5] ntdll: Make NtWriteFile handle special offset -2 same way as -1. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Sep 9 03:07:37 CDT 2013
---
dlls/ntdll/file.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 7c65155..fec7df4 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -973,28 +973,27 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
if (off == (off_t)-1 /* FILE_WRITE_TO_END_OF_FILE */)
off = lseek( unix_handle, 0, SEEK_END );
+ else if (off == (off_t)-2 /* FILE_USE_FILE_POINTER_POSITION */)
+ off = lseek( unix_handle, 0, SEEK_CUR );
- if (off != (off_t)-2 /* FILE_USE_FILE_POINTER_POSITION */)
+ /* async I/O doesn't make sense on regular files */
+ while ((result = pwrite( unix_handle, buffer, length, off )) == -1)
{
- /* async I/O doesn't make sense on regular files */
- while ((result = pwrite( unix_handle, buffer, length, off )) == -1)
+ if (errno != EINTR)
{
- if (errno != EINTR)
- {
- if (errno == EFAULT) status = STATUS_INVALID_USER_BUFFER;
- else status = FILE_GetNtStatus();
- goto done;
- }
+ if (errno == EFAULT) status = STATUS_INVALID_USER_BUFFER;
+ else status = FILE_GetNtStatus();
+ goto done;
}
+ }
- if (options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
- /* update file pointer position */
- lseek( unix_handle, off + result, SEEK_SET );
+ if (options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
+ /* update file pointer position */
+ lseek( unix_handle, off + result, SEEK_SET );
- total = result;
- status = STATUS_SUCCESS;
- goto done;
- }
+ total = result;
+ status = STATUS_SUCCESS;
+ goto done;
}
for (;;)
--
1.8.3.4
More information about the wine-patches
mailing list