diff options
author | drh <drh@noemail.net> | 2016-12-05 20:06:45 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-12-05 20:06:45 +0000 |
commit | 25ef7f55d778708e96694a16fa1f319f0ff4b96f (patch) | |
tree | 3ecbbfaf8fbd5c0b5a03a7305eb528b9ddd6ccc8 /src/os_unix.c | |
parent | 6d4e9c3d921aa651d84a04ac23bb4f4833e2688a (diff) | |
download | sqlite-25ef7f55d778708e96694a16fa1f319f0ff4b96f.tar.gz sqlite-25ef7f55d778708e96694a16fa1f319f0ff4b96f.zip |
Work around a bug in the definition of "ino_t" on some versions of Android.
FossilOrigin-Name: 8df492c1711bfea250264fdaa4892e0842705f83
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 08d4cb5d1..7f0ebdba6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -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 ){ |