[tracker/wip/carlosg/coverity-fixes: 8/16] libtracker-data: Check the return value of write_ontologies_gvdb()




commit c72717ad5bbc2613600b0f524dfed33a68571e6f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 23 13:53:05 2021 +0200

    libtracker-data: Check the return value of write_ontologies_gvdb()
    
    This is error worthy if we fail to snapshot the ontology info there.
    
    CID: #1506252

 src/libtracker-data/tracker-data-manager.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 314b83d19..746d14465 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -4191,7 +4191,10 @@ tracker_data_manager_initable_init (GInitable     *initable,
                        }
                }
 
-               write_ontologies_gvdb (manager, TRUE /* overwrite */, NULL);
+               if (!write_ontologies_gvdb (manager, TRUE /* overwrite */, &internal_error)) {
+                       g_propagate_error (error, internal_error);
+                       goto rollback_newly_created_db;
+               }
 
                ontologies = tracker_ontologies_get_ontologies (manager->ontologies, &n_ontologies);
 
@@ -4243,7 +4246,10 @@ tracker_data_manager_initable_init (GInitable     *initable,
                        }
 
                        if (!read_only) {
-                               write_ontologies_gvdb (manager, FALSE /* overwrite */, NULL);
+                               if (!write_ontologies_gvdb (manager, FALSE /* overwrite */, &internal_error)) 
{
+                                       g_propagate_error (error, internal_error);
+                                       return FALSE;
+                               }
                        }
                }
 
@@ -4589,7 +4595,10 @@ tracker_data_manager_initable_init (GInitable     *initable,
 
                        tracker_data_ontology_process_changes_post_import (seen_classes, seen_properties);
 
-                       write_ontologies_gvdb (manager, TRUE /* overwrite */, NULL);
+                       if (!write_ontologies_gvdb (manager, TRUE /* overwrite */, &internal_error)) {
+                               g_propagate_error (error, internal_error);
+                               goto rollback_db_changes;
+                       }
                }
 
                g_clear_pointer (&seen_classes, g_ptr_array_unref);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]