From f9d18e472bd853c2849de8aee6b8498f20e254f4 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 1 Apr 2013 17:56:28 +0000 Subject: [PATCH] Bug fix in the winMapfile() subroutine: Be sure to record the map object handle in the sqlite3_file object. FossilOrigin-Name: ee4d188e207efa24a26776fa4f025c6ac39cce73 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_win.c | 17 ++++++++--------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index e6eca96ae6..e46bdd10e1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sxFetch\sand\sxUnfetch\smethods\sto\sthe\sos_win.c\sVFS. -D 2013-04-01T17:22:51.830 +C Bug\sfix\sin\sthe\swinMapfile()\ssubroutine:\s\sBe\ssure\sto\srecord\sthe\smap\sobject\nhandle\sin\sthe\ssqlite3_file\sobject. +D 2013-04-01T17:56:28.844 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c d6981218583748080374ed98a03f6a87e2bdc9e0 -F src/os_win.c f705e7ce230f86104dedcc2987a21d564b236659 +F src/os_win.c 390653f5c9b216bd445366f3c2b4863e52d51c24 F src/pager.c 2b9980e87296812a6ce51121a3335550ae25e3ec F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1 F src/parse.y 5d5e12772845805fdfeb889163516b84fbb9ae95 @@ -1040,7 +1040,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P a1040f0397d57855500926494c978623286ddc77 -R 52b13f77704d4760e77e0cfd9ab57bff +P a1653a257d6af6e8b10c819e68b12f6c2f485811 +R 88910ffb14df2e25c8fd9ccc5fce98d7 U drh -Z 878a27609130450cef13cc90a8feab48 +Z d2117afc31dea61942683c2e81660a00 diff --git a/manifest.uuid b/manifest.uuid index c685b6feac..2f1539dbd2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a1653a257d6af6e8b10c819e68b12f6c2f485811 \ No newline at end of file +ee4d188e207efa24a26776fa4f025c6ac39cce73 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index b1f5748638..5ce5a4762a 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -3555,7 +3555,6 @@ static int winUnmapfile(winFile *pFile){ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ sqlite3_int64 nMap = nByte; int rc; - HANDLE hMap = NULL; /* New mapping handle */ assert( nMap>=0 || pFd->nFetchOut==0 ); if( pFd->nFetchOut>0 ) return SQLITE_OK; @@ -3584,17 +3583,17 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ flags |= FILE_MAP_WRITE; } #if SQLITE_OS_WINRT - hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL); + pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL); #elif defined(SQLITE_WIN32_HAS_WIDE) - hMap = osCreateFileMappingW(pFd->h, NULL, protect, + pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect, (DWORD)((nMap>>32) & 0xffffffff), (DWORD)(nMap & 0xffffffff), NULL); #elif defined(SQLITE_WIN32_HAS_ANSI) - hMap = osCreateFileMappingA(pFd->h, NULL, protect, + pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect, (DWORD)((nMap>>32) & 0xffffffff), (DWORD)(nMap & 0xffffffff), NULL); #endif - if( hMap==NULL ){ + if( pFd->hMap==NULL ){ pFd->lastErrno = osGetLastError(); rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno, "winMapfile", pFd->zPath); @@ -3603,13 +3602,13 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ } assert( (nNewRnd % winSysInfo.dwPageSize)==0 ); #if SQLITE_OS_WINRT - pNew = osMapViewOfFileFromApp(hMap, flags, 0, nMap); + pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); #else - pNew = osMapViewOfFile(hMap, flags, 0, 0, (SIZE_T)nMap); + pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); #endif if( pNew==NULL ){ - osCloseHandle(hMap); - hMap = NULL; + osCloseHandle(pFd->hMap); + pFd->hMap = NULL; pFd->lastErrno = osGetLastError(); winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno, "winMapfile", pFd->zPath); -- 2.47.2