diff options
author | Ross Burton <ross.burton@intel.com> | 2020-03-26 15:22:14 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2020-03-28 13:25:52 +0000 |
commit | 9be580a689d1e01e2c061b0a1da6c749d83c0c2c (patch) | |
tree | eb91e25d4647d8619fcc2c4135632d43b9d2d0ad | |
parent | 9aba3df9895f58759f74d6b47f9434c2730d87f4 (diff) | |
download | colord-9be580a689d1e01e2c061b0a1da6c749d83c0c2c.tar.gz |
Check for errors from more sqlite calls
Once the mapping database is opened we call 'PRAGMA synchronous', check
the error code so if the database is corrupted then we can bail sooner
rather than later.
-rw-r--r-- | src/cd-mapping-db.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cd-mapping-db.c b/src/cd-mapping-db.c index 1ef4560..f62e267 100644 --- a/src/cd-mapping-db.c +++ b/src/cd-mapping-db.c @@ -91,9 +91,17 @@ cd_mapping_db_load (CdMappingDb *mdb, } /* we don't need to keep doing fsync */ - sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", - NULL, NULL, NULL); - + rc = sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", + NULL, NULL, &error_msg); + if (rc != SQLITE_OK) { + g_set_error (error, + CD_CLIENT_ERROR, + CD_CLIENT_ERROR_INTERNAL, + "Failed to turn off synchronous operations: SQL error: %s", + error_msg); + sqlite3_free (error_msg); + return FALSE; + } /* check mappings */ rc = sqlite3_exec (priv->db, "SELECT * FROM mappings LIMIT 1", NULL, NULL, &error_msg); |