From: drh Date: Sat, 1 Sep 2007 02:13:10 +0000 (+0000) Subject: Change the windows tempfile name generator so that it uses 119 bits X-Git-Tag: version-3.5.0~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8693475550c42bad5151c7a27e25228900a2be9;p=thirdparty%2Fsqlite.git Change the windows tempfile name generator so that it uses 119 bits of randomness and does not bother to check to see if the file already exists. Ticket #2608. (Unable to test from this machine, but the changes are simple and isolated. Hope it works.) (CVS 4357) FossilOrigin-Name: ca6c1e3f44d8b9d9b76a0efe53ea6a6ad5e14d57 --- diff --git a/manifest b/manifest index 70375d7d37..cac117d23f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Get\smake\sdoc\sworking\sagain.\s(CVS\s4356) -D 2007-08-31T18:50:31 +C Change\sthe\swindows\stempfile\sname\sgenerator\sso\sthat\sit\suses\s119\sbits\nof\srandomness\sand\sdoes\snot\sbother\sto\scheck\sto\ssee\sif\sthe\sfile\salready\nexists.\s\sTicket\s#2608.\s\s(Unable\sto\stest\sfrom\sthis\smachine,\sbut\sthe\nchanges\sare\ssimple\sand\sisolated.\s\sHope\sit\sworks.)\s(CVS\s4357) +D 2007-09-01T02:13:11 F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -118,7 +118,7 @@ F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 F src/os_unix.c 4d36cd037540a9c2af540bd15ab9d2a1dcc164fe F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e -F src/os_win.c 60ab73611d9deb34018ba96bf05bf3b06cc34051 +F src/os_win.c ce778c06afcbfd120ede237befece4655e83c8d0 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c 9b898267587e660a1eed124e95c8fa48b2d7966c F src/pager.h f204c1a9fe0574953fba89c56d9d9bd1ddfa604a @@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 306586c412b87c6d12bac796641517afa3f9eb6a -R 002e8e0983679c6291c6701f9b0da54a +P 8f73ebc6e30467d2c594701e0aa45b53147ef2ef +R 47873120abe0056067c2bbb673058814 U drh -Z 4ae8c52c08c30321820ce9a70abb8993 +Z 9ba63200ed790f0c99661e3e7809f71e diff --git a/manifest.uuid b/manifest.uuid index 55544e34ba..950be95903 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8f73ebc6e30467d2c594701e0aa45b53147ef2ef \ No newline at end of file +ca6c1e3f44d8b9d9b76a0efe53ea6a6ad5e14d57 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 0e2e488eed..91dfaf399b 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1285,17 +1285,14 @@ static int winGetTempName(sqlite3_vfs *pVfs, char *zBuf){ } for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){} zTempPath[i] = 0; - for(;;){ - sqlite3_snprintf(pVfs->mxPathname-30, zBuf, - "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath); - j = strlen(zBuf); - sqlite3Randomness(15, &zBuf[j]); - for(i=0; i<15; i++, j++){ - zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; - } - zBuf[j] = 0; - if( !sqlite3OsAccess(pVfs, zBuf, SQLITE_ACCESS_EXISTS) ) break; - } + sqlite3_snprintf(pVfs->mxPathname-30, zBuf, + "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath); + j = strlen(zBuf); + sqlite3Randomness(20, &zBuf[j]); + for(i=0; i<20; i++, j++){ + zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; + } + zBuf[j] = 0; OSTRACE2("TEMP FILENAME: %s\n", zBuf); return SQLITE_OK; }