From: drh Date: Mon, 5 Jul 2010 21:00:43 +0000 (+0000) Subject: Modify the VFS xAccess() method on winNT so that it returns false for X-Git-Tag: version-3.7.2~190 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=722a7e9ab361c3dc71788aabca8be1ddecf99501;p=thirdparty%2Fsqlite.git Modify the VFS xAccess() method on winNT so that it returns false for an exists test of a zero-length file. This makes the windows VFS work the same as the unix VFS. FossilOrigin-Name: ec35f25403744f7441ac5ae1486b84d8ebc13e98 --- diff --git a/manifest b/manifest index 8824485946..b0f587eecf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Simplify\sthe\sprevious\scommit\sby\sremoving\sthe\spagerCheckForOrDeleteWAL()\swrapper. -D 2010-07-05T19:13:26 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Modify\sthe\sVFS\sxAccess()\smethod\son\swinNT\sso\sthat\sit\sreturns\sfalse\sfor\nan\sexists\stest\sof\sa\szero-length\sfile.\s\sThis\smakes\sthe\swindows\sVFS\swork\nthe\ssame\sas\sthe\sunix\sVFS. +D 2010-07-05T21:00:43 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -155,7 +158,7 @@ F src/os.h d7775504a51e6e0d40315aa427b3e229ff9ff9ca F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19 F src/os_unix.c c6112f0ae34f23ae5ca0189a685e084befbdcf26 -F src/os_win.c 883caa09d8cf7c4dfdef6eba6930466cb8a8275c +F src/os_win.c bdc058198ca969bcf745835e7ca5fadfeb2a51eb F src/pager.c 311571e62fe6a039d2a8dddea830981a6052239a F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e @@ -830,7 +833,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 3053a4ad15343a56efa430503797b77bb6d1e770 -R 1ec303291d035dc0b39644c087426f86 -U dan -Z 86c196ef09ff127a40f174a4579ff6fc +P a1324d125e2dd7004eaf8680f5f832ef17285087 +R b7b5ca572f0c4cfc846cea3094607313 +U drh +Z 13fb6b591c3748fd040ab5e5168b969e +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFMMkf+oxKgR168RlERAmH+AJ4mV5XQd4nFP0MCayWKQVj6n5imSQCffrGL +fAmeRw3++Xx1yEVjikEuOhY= +=4bOD +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index c8faa485f6..ac24f9bc0d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a1324d125e2dd7004eaf8680f5f832ef17285087 \ No newline at end of file +ec35f25403744f7441ac5ae1486b84d8ebc13e98 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 51223dfe97..c11d520263 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2078,7 +2078,17 @@ static int winAccess( return SQLITE_NOMEM; } if( isNT() ){ - attr = GetFileAttributesW((WCHAR*)zConverted); + WIN32_FILE_ATTRIBUTE_DATA sAttrData; + memset(&sAttrData, 0, sizeof(sAttrData)); + attr = GetFileAttributesExW((WCHAR*)zConverted, + GetFileExInfoStandard, &sAttrData); + /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file + ** as if it does not exist. + */ + if( flags==SQLITE_ACCESS_EXISTS && attr!=INVALID_FILE_ATTRIBUTES + && sAttrData.nFileSizeHigh==0 && sAttrData.nFileSizeLow==0 ){ + attr = INVALID_FILE_ATTRIBUTES; + } /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. ** Since the ASCII version of these Windows API do not exist for WINCE, ** it's important to not reference them for WINCE builds.