From: dan Date: Fri, 5 Nov 2010 18:07:37 +0000 (+0000) Subject: Fix os_unix.c so that it works with the test_multiplex module. X-Git-Tag: version-3.7.4~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0c989dde776d428f4696b9de161bda3ed30be3a;p=thirdparty%2Fsqlite.git Fix os_unix.c so that it works with the test_multiplex module. FossilOrigin-Name: 72ba3e368bec34532ec7b5e856a4daa7e1c8cccb --- diff --git a/manifest b/manifest index 430e5fe084..8afa8386cb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\stests\sand\sadded\ssupport\sfor\sxDelete\sin\smultiplex\sVFS. -D 2010-11-05T17:51:25 +C Fix\sos_unix.c\sso\sthat\sit\sworks\swith\sthe\stest_multiplex\smodule. +D 2010-11-05T18:07:37 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -160,7 +160,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e -F src/os_unix.c 00a4a84aba46b61439913bebf0c10d408e42a630 +F src/os_unix.c de5be4cdbf3d07018059934eaf7e5d8d594a895c F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad F src/pager.c 1b0e87deb3994abf12e967ef5b9adc950bf85460 F src/pager.h 8167a1e720d0b7a2790079007128e594010220ad @@ -885,7 +885,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 1ab9a59237bed6d03b55153a67588486f9adc67b -R e3f2efd9b864f5e92369281a6cf12f95 -U shaneh -Z 1f717c7c3b7e6be23615db108e9ab753 +P f2004b44bfba62a7a2296b161a25aefdf55e035a +R e27a910072d0609871439f0ab30ee53c +U dan +Z c8e41ce82005a005e1344343badd82a1 diff --git a/manifest.uuid b/manifest.uuid index 7eabec19ae..1960777db7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f2004b44bfba62a7a2296b161a25aefdf55e035a \ No newline at end of file +72ba3e368bec34532ec7b5e856a4daa7e1c8cccb \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 2b38fd6ca1..9e93a9dcb6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4431,9 +4431,24 @@ static int findCreateFileMode( int nDb; /* Number of valid bytes in zDb */ struct stat sStat; /* Output of stat() on database file */ - nDb = sqlite3Strlen30(zPath) - ((flags & SQLITE_OPEN_WAL) ? 4 : 8); + /* zPath is a path to a WAL or journal file. The following block derives + ** the path to the associated database file from zPath. This block handles + ** the following naming conventions: + ** + ** "-journal" + ** "-wal" + ** "-journal-NNNN" + ** "-wal-NNNN" + ** + ** where NNNN is a 4 digit decimal number. The NNNN naming schemes are + ** used by the test_multiplex.c module. + */ + nDb = sqlite3Strlen30(zPath) - 1; + while( nDb>0 && zPath[nDb]!='l' ) nDb--; + nDb -= ((flags & SQLITE_OPEN_WAL) ? 3 : 7); memcpy(zDb, zPath, nDb); zDb[nDb] = '\0'; + if( 0==stat(zDb, &sStat) ){ *pMode = sStat.st_mode & 0777; }else{