Patch SQLite ftruncate call only on Android.

GitOrigin-RevId: 930b58281ba5eab7d4f560e56b129d8b043fa455
This commit is contained in:
levlam 2020-08-13 22:40:49 +03:00
parent 9592aac404
commit e43f419a6f

View File

@ -42840,8 +42840,12 @@ static int unixLockSharedMemory(unixFile *pDbFd, unixShmNode *pShmNode){
** -shm header size) rather than 0 as a system debugging aid, to
** help detect if a -shm file truncation is legitimate or is the work
** or a rogue process. */
/* Fix SQLite DB corruption on some Samsung devices (3 changed to 0) */
#ifdef __ANDROID__
/* Fix SQLite DB corruption on some Samsung devices */
if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 0) ){
#else
if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 3) ){
#endif
rc = unixLogError(SQLITE_IOERR_SHMOPEN,"ftruncate",pShmNode->zFilename);
}
}