diff options
author | dan <dan@noemail.net> | 2011-03-29 10:04:23 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2011-03-29 10:04:23 +0000 |
commit | 0fd7d860818ebee27fa86b01af296a546a7f944e (patch) | |
tree | bae1293780432094e80cf99d544401d1d31f6765 /src/os_unix.c | |
parent | 278479c1a58231d2432289a9b306d88ef1c75394 (diff) | |
download | sqlite-0fd7d860818ebee27fa86b01af296a546a7f944e.tar.gz sqlite-0fd7d860818ebee27fa86b01af296a546a7f944e.zip |
Fix a problem in the unix VFS implementation of xNextSystemCall(). Also some typos that prevent compilation when HAVE_POSIX_FALLOCATE is defined.
FossilOrigin-Name: bc6cce81565b17f886478bd51500bba2ed11ec1d
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index f4e689fa9..d958b6fc9 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -371,7 +371,7 @@ static struct unix_syscall { #else { "fallocate", (sqlite3_syscall_ptr)0, 0 }, #endif -#define osFallocate ((int(*)(int,off_t,off_t)aSyscall[15].pCurrent) +#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent) }; /* End of the overrideable system calls */ @@ -444,18 +444,16 @@ static sqlite3_syscall_ptr unixGetSystemCall( ** system call. */ static const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){ - unsigned int i; + int i = -1; UNUSED_PARAMETER(p); - if( zName==0 ){ - i = -1; - }else{ - for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0])-1; i++){ - if( strcmp(zName, aSyscall[0].zName)==0 ) break; + if( zName ){ + for(i=0; i<ArraySize(aSyscall)-1; i++){ + if( strcmp(zName, aSyscall[i].zName)==0 ) break; } } - for(i++; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){ - if( aSyscall[0].pCurrent!=0 ) return aSyscall[0].zName; + for(i++; i<ArraySize(aSyscall); i++){ + if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName; } return 0; } @@ -3380,8 +3378,8 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE int rc; do{ - rc = osFallocate(pFile->.h, buf.st_size, nSize-buf.st_size; - }while( rc<0 && errno=EINTR ); + rc = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size); + }while( rc<0 && errno==EINTR ); if( rc ) return SQLITE_IOERR_WRITE; #else /* If the OS does not have posix_fallocate(), fake it. First use |