From: drh Date: Mon, 7 May 2012 13:15:20 +0000 (+0000) Subject: Do not do the AV retry loop on open if the file that is attempting to be X-Git-Tag: version-3.7.12~14^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e039a240fa330cc14a33c5db56709b146db4b71;p=thirdparty%2Fsqlite.git Do not do the AV retry loop on open if the file that is attempting to be opened is really a directory. FossilOrigin-Name: 03875633f465e82fbe99829f96db25f6d32bd333 --- diff --git a/manifest b/manifest index 4f0a71baca..3527b8bf9f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sa\stest\sin\sio.test\sto\saccount\sfor\s[05f98d4eec]. -D 2012-05-01T14:21:57.706 +C Do\snot\sdo\sthe\sAV\sretry\sloop\son\sopen\sif\sthe\sfile\sthat\sis\sattempting\sto\sbe\nopened\sis\sreally\sa\sdirectory. +D 2012-05-07T13:15:20.389 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -160,7 +160,7 @@ F src/os.h 59beba555b65a450bd1d804220532971d4299f60 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 424d46e0edab969293c2223f09923b2178171f47 -F src/os_win.c 5e9e933a412ab35de2a6506b3c6a8295b31b309e +F src/os_win.c 5245515000a855dd0fe4f6e86dfe599cd7865b7b F src/pager.c bb5635dde0b152797836d1c72275284724bb563c F src/pager.h ef1eaf8593e78f73885c1dfac27ad83bee23bdc5 F src/parse.y eb054bb40a5bf90d3422a01ed0e5df229461727a @@ -995,7 +995,10 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 1e51bffe777587cd05bd7db5e02d6291c3eb8c1a -R 2c954175673c357079573f576ee6e960 -U dan -Z 199b9a45180c95acb6ae422881191984 +P bfa61e781cb442be641486e7e55a1518e888d830 +R 6a3c8de48e2cdbaf71c115aca5627de9 +T *branch * win-check-dir +T *sym-win-check-dir * +T -sym-trunk * +U drh +Z 19d1e551d55fac16aea402b33644e4b5 diff --git a/manifest.uuid b/manifest.uuid index 8d74f647e3..24ae4d715c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bfa61e781cb442be641486e7e55a1518e888d830 \ No newline at end of file +03875633f465e82fbe99829f96db25f6d32bd333 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 358b70c128..0f32561937 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -3031,6 +3031,29 @@ static int getTempname(int nBuf, char *zBuf){ return SQLITE_OK; } +/* Forward reference */ +static int winAccess(sqlite3_vfs*,const char*,int,int*); + +/* +** Return TRUE if the named file is really a directory. Return false if +** it is something other than a directory, or if there is any kind of memory +** allocation failure. +*/ +static int winIsDir(sqlite3_vfs *pVfs, const char *zName){ + int isDir = 0; + int rc; + char *zDirName; + + zDirName = sqlite3_mprintf("%s/nul", zName); + if( zDirName ){ + rc = winAccess(pVfs, zDirName, SQLITE_ACCESS_EXISTS, &isDir); + sqlite3_free(zDirName); + }else{ + rc = SQLITE_NOMEM; + } + return rc==SQLITE_OK && isDir; +} + /* ** Open a file. */ @@ -3185,12 +3208,11 @@ static int winOpen( dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, - NULL))==INVALID_HANDLE_VALUE && - retryIoerr(&cnt, &lastErrno) ){} -/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. -** Since the ANSI version of these Windows API do not exist for WINCE, -** it's important to not reference them for WINCE builds. -*/ + NULL))==INVALID_HANDLE_VALUE + && !winIsDir(pVfs, zName) + && retryIoerr(&cnt, &lastErrno) ){ + /* Noop */ + } #if SQLITE_OS_WINCE==0 }else{ while( (h = osCreateFileA((LPCSTR)zConverted,