[evolution-data-server] camel: Print a warning on failing to save migrated maildir version



commit 5667b41983e6a2c7163f09d4c68970a53dfde718
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon May 19 14:33:10 2014 +0100

    camel: Print a warning on failing to save migrated maildir version
    
    Rather than ignoring potential failure completely.
    
    Coverity issue: #1214488
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730375

 camel/providers/local/camel-maildir-store.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 9a3ff35..c2912f6 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -1275,7 +1275,7 @@ maildir_migrate_hierarchy (CamelMaildirStore *mstore,
                            GError **error)
 {
        CamelFolderInfo *topfi;
-       gchar *meta_path, *ptr;
+       gchar *meta_path = NULL, *ptr;
 
        topfi = camel_folder_info_new ();
        topfi->full_name = g_strdup (".");
@@ -1283,8 +1283,7 @@ maildir_migrate_hierarchy (CamelMaildirStore *mstore,
 
        if (scan_old_dir_info ((CamelStore *) mstore, topfi, error) == -1) {
                g_warning ("Failed to scan the old folder info \n");
-               camel_folder_info_free (topfi);
-               return;
+               goto done;
        }
 
        if (maildir_version < 1)
@@ -1297,8 +1296,12 @@ maildir_migrate_hierarchy (CamelMaildirStore *mstore,
        /* cannot pass dot inside maildir_get_meta_path(), because it is escaped */
        ptr[0] = '.';
 
-       g_file_set_contents (meta_path, MAILDIR_CONTENT_VERSION_STR, -1, NULL);
+       if (!g_file_set_contents (meta_path, MAILDIR_CONTENT_VERSION_STR, -1, error)) {
+               g_warning ("Failed to save the maildir version in ā€˜%sā€™.", meta_path);
+               goto done;
+       }
 
+done:
        camel_folder_info_free (topfi);
        g_free (meta_path);
 }


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