From c384bd5c922aab1f1112774d9af7a0414a1f2899 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 20 Nov 2013 08:06:33 +0000 Subject: [PATCH] merged non-sparse file_size bug on windows from RC_0_16 --- ChangeLog | 1 + src/file.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab51ebbaf..b77b4b4c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix bug in non-sparse mode on windows, causing incorrect file errors to be generated * fix set_name() on file_storage actually affecting save paths * fix large file support issue on mingw * add some error handling to set_piece_hashes() diff --git a/src/file.cpp b/src/file.cpp index 60955b18a..ee94cc01f 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -2050,8 +2050,11 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { DWORD high_dword = 0; offs.LowPart = GetCompressedFileSize_(m_path.c_str(), &high_dword); offs.HighPart = high_dword; - ec.assign(GetLastError(), get_system_category()); - if (ec) return false; + if (offs.LowPart == INVALID_FILE_SIZE) + { + ec.assign(GetLastError(), get_system_category()); + if (ec) return false; + } if (offs.QuadPart != s) { // if the user has permissions, avoid filling