summaryrefslogtreecommitdiff
path: root/storage/connect/maputil.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-05-05 17:36:16 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-05-05 17:36:16 +0200
commit9d41d856a7de0e70ef5003686dde889c021b0af8 (patch)
tree65df574bb558bee399bc8dd3ce37b991784c9f19 /storage/connect/maputil.cpp
parentf3af6da9765a4541d63de91e8a848d3c3116e957 (diff)
downloadmariadb-git-9d41d856a7de0e70ef5003686dde889c021b0af8.tar.gz
- Fix a bug concerning index mapping that caused mapped index files
not to be unmapped. This caused a crash instead of reporting an error. This was also fixed. modified: storage/connect/connect.cc storage/connect/ha_connect.cc storage/connect/maputil.cpp storage/connect/table.cpp storage/connect/xindex.cpp storage/connect/xindex.h storage/connect/xtable.h
Diffstat (limited to 'storage/connect/maputil.cpp')
-rw-r--r--storage/connect/maputil.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp
index b7032f10d2b..7104259ebad 100644
--- a/storage/connect/maputil.cpp
+++ b/storage/connect/maputil.cpp
@@ -80,7 +80,16 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR filename,
} // endif hFileMap
access = (mode == MODE_READ) ? FILE_MAP_READ : FILE_MAP_WRITE;
- mm->memory = MapViewOfFile(hFileMap, access, 0, 0, 0);
+
+ if (!(mm->memory = MapViewOfFile(hFileMap, access, 0, 0, 0))) {
+ DWORD ler = GetLastError();
+
+ sprintf(g->Message, "Error %ld in MapViewOfFile %s",
+ ler, filename);
+ CloseHandle(hFile);
+ return INVALID_HANDLE_VALUE;
+ } // endif memory
+
// lenH is the high-order word of the file size
mm->lenL = GetFileSize(hFile, &mm->lenH);
CloseHandle(hFileMap); // Not used anymore