1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Avoid returning SQLITE_NOTFOUND when the unix xSetSystemCall interface is invoked with NULL passed as the second argument, even if all the default system calls are already installed.

FossilOrigin-Name: 3b91eaaa0b3c25022332ba3d1a5651848fc5d84c
This commit is contained in:
dan
2011-04-02 17:00:47 +00:00
parent 6c15487b7e
commit 51438a7936
6 changed files with 52 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\srace\scondition\sin\sOP_ParseSchema. C Avoid\sreturning\sSQLITE_NOTFOUND\swhen\sthe\sunix\sxSetSystemCall\sinterface\sis\sinvoked\swith\sNULL\spassed\sas\sthe\ssecond\sargument,\seven\sif\sall\sthe\sdefault\ssystem\scalls\sare\salready\sinstalled.
D 2011-04-02T09:44:43 D 2011-04-02T17:00:48
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -162,7 +162,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 2596fd2d5d0976c6c0c628d0c3c7c4e7a724f4cf F src/os_os2.c 2596fd2d5d0976c6c0c628d0c3c7c4e7a724f4cf
F src/os_unix.c a3b4cdf50a9c9be8b50dc4932354ab749962a07f F src/os_unix.c 32414676594a0a26cfccd7e02656230a3406eee7
F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845 F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845
F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1 F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
@@ -222,7 +222,7 @@ F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c 61bb14684142a19c580a13b4dde680044d37e0f5 F src/test_syscall.c 34ce1be806cd180e241bc688ae3762e5e7825bda
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c bedd05cad673dba53326f3aa468cc803038896c0 F src/test_thread.c bedd05cad673dba53326f3aa468cc803038896c0
F src/test_vfs.c 2ed8853c1e51ac6f9ea091f7ce4e0d618bba8b86 F src/test_vfs.c 2ed8853c1e51ac6f9ea091f7ce4e0d618bba8b86
@@ -594,7 +594,7 @@ F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/omitunique.test bbb2ec4345d9125d9ee21cd9488d97a163020d5f F test/omitunique.test bbb2ec4345d9125d9ee21cd9488d97a163020d5f
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/oserror.test 6c61c859cd94864cfd6af83e0549e2800238c413 F test/oserror.test 0abf1b4a935aae329b95da27388d7ca61aaea6f0
F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
@@ -677,7 +677,7 @@ F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
F test/superlock.test 5d7a4954b0059c903f82c7b67867bc5451a7c082 F test/superlock.test 5d7a4954b0059c903f82c7b67867bc5451a7c082
F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3 F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3
F test/syscall.test d1dae1fee88613cf763d97ad0038d867509e0c42 F test/syscall.test b967e1f5405bb1c9e2e223dbf7d7cd35220589a3
F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f
F test/table.test 04ba066432430657712d167ebf28080fe878d305 F test/table.test 04ba066432430657712d167ebf28080fe878d305
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
@@ -926,7 +926,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 20afd81a4cf4d23962ec841bbd375f36a5156fb6 P 71a799b02a3b3cf2e12758dea29fd2465bbec3e1
R 25d34b3e2efbdd1c8e0ceadec6512306 R 96ca391ad53fdccc5149ee67daf1eb80
U dan U dan
Z 659aea6fa897bf521b0a686e5d197299 Z 09bfa66b6aa34161ab06f7710f843391

View File

@@ -1 +1 @@
71a799b02a3b3cf2e12758dea29fd2465bbec3e1 3b91eaaa0b3c25022332ba3d1a5651848fc5d84c

View File

@@ -394,10 +394,10 @@ static int unixSetSystemCall(
/* If no zName is given, restore all system calls to their default /* If no zName is given, restore all system calls to their default
** settings and return NULL ** settings and return NULL
*/ */
rc = SQLITE_OK;
for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
if( aSyscall[i].pDefault ){ if( aSyscall[i].pDefault ){
aSyscall[i].pCurrent = aSyscall[i].pDefault; aSyscall[i].pCurrent = aSyscall[i].pDefault;
rc = SQLITE_OK;
} }
} }
}else{ }else{

View File

@@ -599,6 +599,24 @@ static int test_syscall_list(
return TCL_OK; return TCL_OK;
} }
static int test_syscall_defaultvfs(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3_vfs *pVfs;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 2, objv, "");
return TCL_ERROR;
}
pVfs = sqlite3_vfs_find(0);
Tcl_SetObjResult(interp, Tcl_NewStringObj(pVfs->zName, -1));
return TCL_OK;
}
static int test_syscall( static int test_syscall(
void * clientData, void * clientData,
Tcl_Interp *interp, Tcl_Interp *interp,
@@ -616,6 +634,7 @@ static int test_syscall(
{ "errno", test_syscall_errno }, { "errno", test_syscall_errno },
{ "exists", test_syscall_exists }, { "exists", test_syscall_exists },
{ "list", test_syscall_list }, { "list", test_syscall_list },
{ "defaultvfs", test_syscall_defaultvfs },
{ 0, 0 } { 0, 0 }
}; };
int iCmd; int iCmd;

View File

@@ -111,6 +111,7 @@ do_test 2.1.3 {
} {} } {}
test_syscall reset
sqlite3_shutdown sqlite3_shutdown
test_sqlite3_log test_sqlite3_log
sqlite3_initialize sqlite3_initialize

View File

@@ -19,8 +19,12 @@ if {[llength [info commands test_syscall]]==0} {
finish_test finish_test
return return
} }
set testprefix syscall
if {[test_syscall defaultvfs] != "unix"} {
finish_test
return
}
set testprefix syscall
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Tests for the xSetSystemCall method. # Tests for the xSetSystemCall method.
@@ -52,12 +56,14 @@ do_test 2.1.2 { test_syscall exists nosuchcall } 0
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Tests for the xNextSystemCall method. # Tests for the xNextSystemCall method.
# #
set syscall_list [list \ foreach s {
open close access getcwd stat fstat ftruncate \ open close access getcwd stat fstat ftruncate
fcntl read pread write pwrite fchmod \ fcntl read pread write pwrite fchmod fallocate
] pread64 pwrite64
if {[test_syscall exists fallocate]} {lappend syscall_list fallocate} } {
do_test 3.1 { test_syscall list } $syscall_list if {[test_syscall exists $s]} {lappend syscall_list $s}
}
do_test 3.1 { lsort [test_syscall list] } [lsort $syscall_list]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# This test verifies that if a call to open() fails and errno is set to # This test verifies that if a call to open() fails and errno is set to
@@ -245,6 +251,5 @@ foreach {tn hint size} {
} $size } $size
} }
test_syscall reset
finish_test finish_test