From a815b56d84e1876c5f6e5fc9f4b3bc46a1a3cfb3 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 22 May 2013 06:19:03 +0000 Subject: win32.c: check error of SetFilePointer * win32/win32.c (setup_overlapped): check the error code in addition to the result of SetFilePointer() to determine if an error occurred, because INVALID_SET_FILE_POINTER is a valid value. [ruby-core:55098] [Bug #8431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index 74d13960bc..b7eb4c62f2 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6028,8 +6028,11 @@ setup_overlapped(OVERLAPPED *ol, int fd) #define INVALID_SET_FILE_POINTER ((DWORD)-1) #endif if (low == INVALID_SET_FILE_POINTER) { - errno = map_errno(GetLastError()); - return -1; + DWORD err = GetLastError(); + if (err != NO_ERROR) { + errno = map_errno(err); + return -1; + } } ol->Offset = low; ol->OffsetHigh = high; -- cgit v1.2.3