From 7b2be278f11553a716a52a681f6f972a1e015c21 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 17 Feb 2009 00:00:21 +0000 Subject: [PATCH] windows file fix --- src/file.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/file.cpp b/src/file.cpp index 5ab27f796..0cfc7da6c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -651,12 +651,14 @@ namespace libtorrent CloseHandle(ol.hEvent); return -1; } - if (GetOverlappedResult(m_file_handle, &ol, &ret, true) == 0) + DWORD tmp; + if (GetOverlappedResult(m_file_handle, &ol, &tmp, true) == 0) { ec = error_code(GetLastError(), get_system_category()); CloseHandle(ol.hEvent); return -1; } + if (tmp < ret) ret = tmp; } CloseHandle(ol.hEvent);