diff options
| author | Pieter Wuille <[email protected]> | 2013-04-29 16:36:25 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2013-04-29 16:36:25 -0700 |
| commit | d2cefe1674e2111f579d980ea68ab719368c67df (patch) | |
| tree | 3e560075d9957104cdae67dafa26bdf4ad8b40ad /src | |
| parent | Merge pull request #2568 from sipa/rlimit (diff) | |
| parent | Allow files to be opened for reading multiple times (diff) | |
| download | discoin-d2cefe1674e2111f579d980ea68ab719368c67df.tar.xz discoin-d2cefe1674e2111f579d980ea68ab719368c67df.zip | |
Merge pull request #2589 from sipa/win32ldberr
Some win32-leveldb related fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/leveldb/util/env_win.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/leveldb/util/env_win.cc b/src/leveldb/util/env_win.cc index f1a761062..ef2ecae83 100644 --- a/src/leveldb/util/env_win.cc +++ b/src/leveldb/util/env_win.cc @@ -420,7 +420,7 @@ BOOL Win32RandomAccessFile::_Init( LPCWSTR path ) { BOOL bRet = FALSE; if(!_hFile) - _hFile = ::CreateFileW(path,GENERIC_READ,0,NULL,OPEN_EXISTING, + _hFile = ::CreateFileW(path,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,NULL); if(!_hFile || _hFile == INVALID_HANDLE_VALUE ) _hFile = NULL; @@ -462,8 +462,8 @@ bool Win32MapFile::_UnmapCurrentRegion() // Defer syncing this data until next Sync() call, if any _pending_sync = true; } - UnmapViewOfFile(_base); - CloseHandle(_base_handle); + if (!UnmapViewOfFile(_base) || !CloseHandle(_base_handle)) + result = false; _file_offset += _limit - _base; _base = NULL; _base_handle = NULL; @@ -971,7 +971,7 @@ Status Win32Env::NewRandomAccessFile( const std::string& fname, RandomAccessFile if(!pFile->isEnable()){ delete pFile; *result = NULL; - sRet = Status::IOError(path,"Could not create random access file."); + sRet = Status::IOError(path, Win32::GetLastErrSz()); }else *result = pFile; return sRet; |