Work around a bug in the definition of "ino_t" on some versions of Android.

FossilOrigin-Name: 8df492c1711bfea250264fdaa4892e0842705f83
This commit is contained in:
drh 2016-12-05 20:06:45 +00:00
parent 6d4e9c3d92
commit 25ef7f55d7
3 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Simplify\sthe\sdate/time\sfunction\slogic\sfor\simproved\srebustness\sand\salso\sto\ndecrease\sthe\ssize\sof\sthe\sbinary.
D 2016-12-02T19:07:03.138
C Work\saround\sa\sbug\sin\sthe\sdefinition\sof\s"ino_t"\son\ssome\sversions\sof\sAndroid.
D 2016-12-05T20:06:45.078
F Makefile.in 7639c6a09da11a9c7c6f2630fc981ee588d1072d
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -372,7 +372,7 @@ F src/os.c add02933b1dce7a39a005b00a2f5364b763e9a24
F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
F src/os_unix.c be9ca0f901a2b6c1bc93dc338f4863675180c189
F src/os_unix.c 30e2c43e4955db990e5b5a81e901f8aa74cc8820
F src/os_win.c cf90abd4e50d9f56d2c20ce8e005aff55d7bd8e9
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 4e4aea7ced5734753ccbff4cf4bb4d032cf2173e
@ -1536,7 +1536,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 768c9859b21a3c88be084d6dd87acab4211b3a87
R 65ce4f7c2b4b3fd05ab801cab333052f
P 6e144735ed0cd3d4461ae6a4d8034264563e3165
R 8d68a5c1fa2466ac0f1223eb05620da4
U drh
Z 0e9aea10c8c8bd36917285b40426a93d
Z 14362e44254b879dd6931510df84654e

View File

@ -1 +1 @@
6e144735ed0cd3d4461ae6a4d8034264563e3165
8df492c1711bfea250264fdaa4892e0842705f83

View File

@ -1061,7 +1061,14 @@ struct unixFileId {
#if OS_VXWORKS
struct vxworksFileId *pId; /* Unique file ID for vxworks. */
#else
ino_t ino; /* Inode number */
/* We are told that some versions of Android contain a bug that
** sizes ino_t at only 32-bits instead of 64-bits. (See
** https://android-review.googlesource.com/#/c/115351/3/dist/sqlite3.c)
** To work around this, always allocate 64-bits for the inode number.
** On small machines that only have 32-bit inodes, this wastes 4 bytes,
** but that should not be a big deal. */
/* WAS: ino_t ino; */
u64 ino; /* Inode number */
#endif
};
@ -1306,7 +1313,7 @@ static int findInodeInfo(
#if OS_VXWORKS
fileId.pId = pFile->pId;
#else
fileId.ino = statbuf.st_ino;
fileId.ino = (u64)statbuf.st_ino;
#endif
pInode = inodeList;
while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
@ -1340,7 +1347,8 @@ static int fileHasMoved(unixFile *pFile){
#else
struct stat buf;
return pFile->pInode!=0 &&
(osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino);
(osStat(pFile->zPath, &buf)!=0
|| (u64)buf.st_ino!=pFile->pInode->fileId.ino);
#endif
}
@ -5512,7 +5520,7 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
unixEnterMutex();
pInode = inodeList;
while( pInode && (pInode->fileId.dev!=sStat.st_dev
|| pInode->fileId.ino!=sStat.st_ino) ){
|| pInode->fileId.ino!=(u64)sStat.st_ino) ){
pInode = pInode->pNext;
}
if( pInode ){