diff options
author | zbordas <zbordas@kollective.com> | 2019-11-08 09:31:16 +0100 |
---|---|---|
committer | zbordas <zbordas@kollective.com> | 2019-11-08 09:31:16 +0100 |
commit | 02b298b4623de0ce3f87a1a2e3def53aba89126a (patch) | |
tree | a40fc6e07b3b2c656da63a8a6dc54f8044ebca0f | |
parent | 95a8ab8b985b32d5159c2b6b545eb731efd48c16 (diff) | |
download | nspr-hg-02b298b4623de0ce3f87a1a2e3def53aba89126a.tar.gz |
Bug 1586070 - Read does not advance file position for files larger than 4GB on Win32. (See also bug 70765.) r=kaie
-rw-r--r-- | pr/src/md/windows/ntio.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index 040bbd31..40f52007 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -2252,6 +2252,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) int rv, err; LONG hiOffset = 0; LONG loOffset; + LARGE_INTEGER offset; /* use for a normalized add of len to offset */ if (!fd->secret->md.sync_file_io) { PRThread *me = _PR_MD_CURRENT_THREAD(); @@ -2368,7 +2369,14 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) return -1; } - SetFilePointer((HANDLE)f, me->md.blocked_io_bytes, 0, FILE_CURRENT); + /* Apply the workaround from bug 70765 (see _PR_MD_WRITE) + * to the reading code, too. */ + + offset.LowPart = me->md.overlapped.overlapped.Offset; + offset.HighPart = me->md.overlapped.overlapped.OffsetHigh; + offset.QuadPart += me->md.blocked_io_bytes; + + SetFilePointer((HANDLE)f, offset.LowPart, &offset.HighPart, FILE_BEGIN); PR_ASSERT(me->io_pending == PR_FALSE); |