Fix bugs of database corruption following IO error on systems supporting atomic-write

SQLite on Android uses AUTO_VACUUM option.
When the disk space is critically low and atomic-write option is enabled,
SQLite writes transactions that modify a single database page on disk
without creating a journal file.

Due to a bug, if an IO or disk full error occurs while transferring
the contents to disk, the single page that was modified in the cache
is not being rolled back - cache corruption.
As a result, applications get a database corruption exception
for next database transactions.

This patch changes createFile() to close pReal in case of IO error.
Therefore, cache is being rolled back.

This patch is originated from www.sqlite.org.
(URL: http://www.sqlite.org/src/tktview?name=df678d738a)

Change-Id: Ieecda65d8458cb591bd4d89d8b423a4479f50ea8
1 file changed
tree: 88d0fa0d8e4ce5f77b2ad72670aa53d32d43beac
  1. android/
  2. dist/
  3. CleanSpec.mk