Sqlite: fix DB corruption on some Samsung devices

GitOrigin-RevId: bc3e631f6873c0a4a53b8aea2159727fa0d1e956
This commit is contained in:
Arseny Smirnov 2020-08-12 22:54:34 +03:00
parent 0ef5577209
commit d4f0162ee9
1 changed files with 2 additions and 1 deletions

View File

@ -42840,7 +42840,8 @@ 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. */
if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 3) ){
/* Fix SQLite DB corruption on some Samsung devices (3 changed to 0) */
if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 0) ){
rc = unixLogError(SQLITE_IOERR_SHMOPEN,"ftruncate",pShmNode->zFilename);
}
}