[evolution-data-server] [Maildir] g_mkdir() doesn't fail, if the folder already exists
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [Maildir] g_mkdir() doesn't fail, if the folder already exists
- Date: Tue, 10 Jun 2014 14:00:09 +0000 (UTC)
commit 1bf10f9d22a9a9f642c8d4591ccf04d44f92344d
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 10 15:56:34 2014 +0200
[Maildir] g_mkdir() doesn't fail, if the folder already exists
There could happen that only some of the cur/new/tmp triple were
missing, but in that case the Maildir folder could not be opened,
because the g_mkdir() returned failure and a test for EEXIST was
not in this code part. Other code parts have it, thus let's add
it here as well.
camel/providers/local/camel-maildir-store.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index c2912f6..1ea928b 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -232,9 +232,9 @@ maildir_store_get_folder_sync (CamelStore *store,
if (g_stat (tmp, &st) != 0 || !S_ISDIR (st.st_mode)
|| g_stat (cur, &st) != 0 || !S_ISDIR (st.st_mode)
|| g_stat (new, &st) != 0 || !S_ISDIR (st.st_mode)) {
- if (g_mkdir (tmp, 0700) != 0
- || g_mkdir (cur, 0700) != 0
- || g_mkdir (new, 0700) != 0) {
+ if ((g_mkdir (tmp, 0700) != 0 && errno != EEXIST)
+ || (g_mkdir (cur, 0700) != 0 && errno != EEXIST)
+ || (g_mkdir (new, 0700) != 0 && errno != EEXIST)) {
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -262,10 +262,10 @@ maildir_store_get_folder_sync (CamelStore *store,
_("Cannot get folder '%s': folder does not exist."),
folder_name);
} else {
- if (g_mkdir (name, 0700) != 0
- || g_mkdir (tmp, 0700) != 0
- || g_mkdir (cur, 0700) != 0
- || g_mkdir (new, 0700) != 0) {
+ if ((g_mkdir (name, 0700) != 0 && errno != EEXIST)
+ || (g_mkdir (tmp, 0700) != 0 && errno != EEXIST)
+ || (g_mkdir (cur, 0700) != 0 && errno != EEXIST)
+ || (g_mkdir (new, 0700) != 0 && errno != EEXIST)) {
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]