From 2aa5a00e708f46577ab3e6f33fe562183a33f88c Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Apr 2011 13:42:25 +0000 Subject: Make sure the array of overloadable system calls is always correctly sized, regardless of the compile-time configuration. Ticket [bb3a86e890c8e96ab]. FossilOrigin-Name: c6e727ab3b16e71b0151673bb24b0bafec368ee6 --- src/os_unix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/os_unix.c') diff --git a/src/os_unix.c b/src/os_unix.c index f0e8258f1..744d85776 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -365,8 +365,10 @@ static struct unix_syscall { #if SQLITE_ENABLE_LOCKING_STYLE { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 }, -#define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent) +#else + { "fchmod", (sqlite3_syscall_ptr)0, 0 }, #endif +#define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent) #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE { "fallocate", (sqlite3_syscall_ptr)posix_fallocate, 0 }, @@ -6684,6 +6686,10 @@ int sqlite3_os_init(void){ }; unsigned int i; /* Loop counter */ + /* Double-check that the aSyscall[] array has been constructed + ** correctly. See ticket [bb3a86e890c8e96ab] */ + assert( ArraySize(aSyscall)==16 ); + /* Register all VFSes defined in the aVfs[] array */ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ sqlite3_vfs_register(&aVfs[i], i==0); -- cgit v1.2.3