[tracker/wip/carlosg/coverity-fixes: 7/16] libtracker-data: Warn in place during rollback on first time db creation
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/coverity-fixes: 7/16] libtracker-data: Warn in place during rollback on first time db creation
- Date: Sat, 23 Oct 2021 18:42:00 +0000 (UTC)
commit c81805e66c5d0b7648b325cf40121111e3ed816b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 23 13:44:37 2021 +0200
libtracker-data: Warn in place during rollback on first time db creation
The return value and error are unused and ignored. Since these are error
paths themselves, warn in place if we cannot delete the database file
after rolling back its first creation.
CID: #1506251
src/libtracker-data/tracker-data-manager.c | 2 +-
src/libtracker-data/tracker-db-manager.c | 16 ++++++++--------
src/libtracker-data/tracker-db-manager.h | 3 +--
3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 14ca1a71a..314b83d19 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -4658,7 +4658,7 @@ rollback_db_changes:
rollback_newly_created_db:
tracker_data_rollback_transaction (manager->data_update);
- tracker_db_manager_rollback_db_creation (manager->db_manager, NULL);
+ tracker_db_manager_rollback_db_creation (manager->db_manager);
return FALSE;
}
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 79e0d6ffd..96061c03f 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -463,27 +463,27 @@ tracker_db_manager_db_exists (GFile *cache_location)
return db_exists;
}
-int
-tracker_db_manager_rollback_db_creation (TrackerDBManager *db_manager,
- GError **error)
+void
+tracker_db_manager_rollback_db_creation (TrackerDBManager *db_manager)
{
gchar *dir;
gchar *filename;
- int ret;
- g_return_val_if_fail (db_manager->first_time, -1);
+ g_return_if_fail (db_manager->first_time);
if ((db_manager->flags & TRACKER_DB_MANAGER_IN_MEMORY) != 0)
- return 0;
+ return;
dir = g_file_get_path (db_manager->cache_location);
filename = g_build_filename (dir, db_base.file, NULL);
- ret = g_unlink (filename);
+ if (g_unlink (filename) < 0) {
+ g_warning ("Could not delete database file '%s': %m",
+ db_base.file);
+ }
g_free (dir);
g_free (filename);
- return ret;
}
static gboolean
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index 62bf3b944..3f90f53ce 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -50,8 +50,7 @@ typedef enum {
TRACKER_DB_MANAGER_SKIP_VERSION_CHECK = 1 << 9,
} TrackerDBManagerFlags;
-int tracker_db_manager_rollback_db_creation (TrackerDBManager *db_manager,
- GError **error);
+void tracker_db_manager_rollback_db_creation (TrackerDBManager *db_manager);
gboolean tracker_db_manager_db_exists (GFile *cache_location);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]