Milan Crha e2cf03
diff -up evolution-data-server-3.8.5/camel/providers/local/camel-maildir-store.c.maildir-tmp-autocreate evolution-data-server-3.8.5/camel/providers/local/camel-maildir-store.c
Milan Crha e2cf03
--- evolution-data-server-3.8.5/camel/providers/local/camel-maildir-store.c.maildir-tmp-autocreate	2013-07-23 13:57:51.000000000 +0200
Milan Crha e2cf03
+++ evolution-data-server-3.8.5/camel/providers/local/camel-maildir-store.c	2013-08-12 10:31:18.600063994 +0200
Milan Crha e2cf03
@@ -506,9 +506,11 @@ scan_fi (CamelStore *store,
Milan Crha e2cf03
 	cur = g_build_filename (path, dir_name, "cur", NULL);
Milan Crha e2cf03
 	new = g_build_filename (path, dir_name, "new", NULL);
Milan Crha e2cf03
 
Milan Crha e2cf03
-	if (!(g_stat (tmp, &st) == 0 && S_ISDIR (st.st_mode)
Milan Crha e2cf03
-	      && g_stat (cur, &st) == 0 && S_ISDIR (st.st_mode)
Milan Crha e2cf03
-	      && g_stat (new, &st) == 0 && S_ISDIR (st.st_mode)))
Milan Crha e2cf03
+	if (!(g_stat (cur, &st) == 0 && S_ISDIR (st.st_mode)
Milan Crha e2cf03
+	      && g_stat (new, &st) == 0 && S_ISDIR (st.st_mode)
Milan Crha e2cf03
+	      /* Create 'tmp' dir on demand, if other directories are there,
Milan Crha e2cf03
+		 because some backup tools can drop the 'tmp' directory. */
Milan Crha e2cf03
+	      && ((g_stat (tmp, &st) == 0 && S_ISDIR (st.st_mode)) || g_mkdir (tmp, 0700) == 0)))
Milan Crha e2cf03
 		fi->flags |= CAMEL_FOLDER_NOSELECT;
Milan Crha e2cf03
 
Milan Crha e2cf03
 	g_free (new);