[evolution-data-server] Bug #633156 - Runtime warning when creating direct subfolder of On This Computer



commit d486a9224d36a011323843266e9a34e519ebb99d
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 25 16:47:50 2011 +0100

    Bug #633156 - Runtime warning when creating direct subfolder of On This Computer

 camel/camel-text-index.c                    |    7 +++++--
 camel/providers/local/camel-local-store.c   |    4 ++--
 camel/providers/local/camel-maildir-store.c |    4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 0d20b2c..7d5f96e 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -1001,11 +1001,14 @@ camel_text_index_remove (const gchar *old)
 	sprintf (block, "%s.index", old);
 	sprintf (key, "%s.index.data", old);
 
-	if (g_unlink (block) == -1 && errno != ENOENT)
+	if (g_unlink (block) == -1 && errno != ENOENT && errno != ENOTDIR)
 		ret = -1;
-	if (g_unlink (key) == -1 && errno != ENOENT)
+	if (g_unlink (key) == -1 && errno != ENOENT && errno != ENOTDIR)
 		ret = -1;
 
+	if (ret == 0)
+		errno = 0;
+
 	return ret;
 }
 
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index 3737bfc..6803135 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -491,7 +491,7 @@ local_store_delete_folder_sync (CamelStore *store,
 	/* remove metadata only */
 	name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name);
 	str = g_strdup_printf("%s.ibex", name);
-	if (camel_text_index_remove (str) == -1 && errno != ENOENT) {
+	if (camel_text_index_remove (str) == -1 && errno != ENOENT && errno != ENOTDIR) {
 		g_set_error (
 			error, G_IO_ERROR,
 			g_io_error_from_errno (errno),
@@ -519,7 +519,7 @@ local_store_delete_folder_sync (CamelStore *store,
 	if (str == NULL)
 		str = g_strdup_printf ("%s.cmeta", name);
 
-	if (g_unlink (str) == -1 && errno != ENOENT) {
+	if (g_unlink (str) == -1 && errno != ENOENT && errno != ENOTDIR) {
 		g_set_error (
 			error, G_IO_ERROR,
 			g_io_error_from_errno (errno),
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 56c9b72..fa1675e 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -110,7 +110,7 @@ maildir_store_create_folder_sync (CamelStore *store,
 		return NULL;
 	}
 
-	if (parent_name) {
+	if (parent_name && *parent_name) {
 		gchar *dir_name = maildir_full_name_to_dir_name (parent_name);
 		name = g_strdup_printf("%s/%s.%s", path, dir_name, folder_name);
 		g_free (dir_name);
@@ -129,7 +129,7 @@ maildir_store_create_folder_sync (CamelStore *store,
 
 	g_free (name);
 
-	if (parent_name)
+	if (parent_name && *parent_name)
 		name = g_strdup_printf("%s/%s", parent_name, folder_name);
 	else
 		name = g_strdup_printf("%s", folder_name);



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