[evolution-data-server] [IMAPx] Avoid useless console warnings after a call to g_rename()



commit 6e57200ca9cbb0bd7dab24ecc2b9d0410879bec2
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 18 12:13:00 2014 +0200

    [IMAPx] Avoid useless console warnings after a call to g_rename()
    
    Some cases when g_rename() is called with nonexistent source file
    are valid, like when appending a message to a (Sent) folder, thus
    do not claim on console in such situations.

 camel/providers/imapx/camel-imapx-server.c |    2 +-
 camel/providers/imapx/camel-imapx-store.c  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 8138258..5e98af2 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5422,7 +5422,7 @@ imapx_command_append_message_done (CamelIMAPXServer *is,
                        mi->uid = camel_pstring_add (data->appended_uid, FALSE);
 
                        cur = camel_data_cache_get_filename  (ifolder->cache, "cur", mi->uid);
-                       if (g_rename (data->path, cur) == -1) {
+                       if (g_rename (data->path, cur) == -1 && errno != ENOENT) {
                                g_warning ("%s: Failed to rename '%s' to '%s': %s", G_STRFUNC, data->path, 
cur, g_strerror (errno));
                        }
 
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 47a889d..1c5c7c7 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -327,7 +327,7 @@ imapx_store_rename_storage_path (CamelIMAPXStore *imapx_store,
        new_storage_path =
                imapx_path_to_physical (root_storage_path, new_mailbox);
 
-       if (g_rename (old_storage_path, new_storage_path) == -1) {
+       if (g_rename (old_storage_path, new_storage_path) == -1 && errno != ENOENT) {
                g_warning (
                        "Could not rename message cache "
                        "'%s' to '%s: %s: cache reset",
@@ -2175,7 +2175,7 @@ imapx_migrate_to_user_cache_dir (CamelService *service)
                g_mkdir_with_parents (parent_dir, S_IRWXU);
                g_free (parent_dir);
 
-               if (g_rename (user_data_dir, user_cache_dir) == -1)
+               if (g_rename (user_data_dir, user_cache_dir) == -1 && errno != ENOENT)
                        g_debug ("%s: Failed to migrate '%s' to '%s': %s", G_STRFUNC, user_data_dir, 
user_cache_dir, g_strerror (errno));
        }
 }


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