From d4f0162ee91a2d5570f742dc533c1d35c282da07 Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Wed, 12 Aug 2020 22:54:34 +0300 Subject: [PATCH] Sqlite: fix DB corruption on some Samsung devices GitOrigin-RevId: bc3e631f6873c0a4a53b8aea2159727fa0d1e956 --- sqlite/sqlite/sqlite3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sqlite/sqlite/sqlite3.c b/sqlite/sqlite/sqlite3.c index a4bbc9ccc..e558fd1c7 100644 --- a/sqlite/sqlite/sqlite3.c +++ b/sqlite/sqlite/sqlite3.c @@ -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); } }