From 1ba02fa492b24ee07a9b9d6992e5ad05bfb1684e Mon Sep 17 00:00:00 2001 From: Jowen Date: Thu, 14 Jun 2018 16:13:21 +0800 Subject: [PATCH] add patch from lxf --- src/lib/database/mman-win32/mman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/database/mman-win32/mman.c b/src/lib/database/mman-win32/mman.c index b4bb6acf1..e3b4d828f 100644 --- a/src/lib/database/mman-win32/mman.c +++ b/src/lib/database/mman-win32/mman.c @@ -210,9 +210,9 @@ int ftruncate(int fd, oft__ size) big.QuadPart = (LONGLONG)size; const HANDLE handle = (HANDLE)_get_osfhandle(fd); - const position = SetFilePointerEx(handle, big, NULL, FILE_BEGIN); + const BOOL ret = SetFilePointerEx(handle, big, NULL, FILE_BEGIN); - if (position == INVALID_SET_FILE_POINTER || SetEndOfFile(handle) == FALSE) + if (!ret || !SetEndOfFile(handle)) { const DWORD error = GetLastError();