[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.134, 1.135

tss at dovecot.org tss at dovecot.org
Sun Dec 3 13:30:03 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv24180/index/maildir

Modified Files:
	maildir-storage.c 
Log Message:
Added MAIL_STORAGE_FLAG_NO_AUTOCREATE flag which silently fails storage
creation if the root directory doesn't exist. Otherwise the root dir is
created.



Index: maildir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- maildir-storage.c	1 Dec 2006 20:55:04 -0000	1.134
+++ maildir-storage.c	3 Dec 2006 13:29:59 -0000	1.135
@@ -144,6 +144,7 @@
 	struct mailbox_list_settings list_set;
 	struct mailbox_list *list;
 	const char *error;
+	struct stat st;
 	pool_t pool;
 
 	if (maildir_get_list_settings(&list_set, data, flags) < 0)
@@ -151,6 +152,17 @@
 	list_set.mail_storage_flags = &flags;
 	list_set.mail_storage_lock_method = &lock_method;
 
+	/* normally the maildir is created in verify_inbox() */
+	if ((flags & MAIL_STORAGE_FLAG_NO_AUTOCREATE) != 0) {
+		if (stat(list_set.root_dir, &st) < 0) {
+			if (errno != ENOENT) {
+				i_error("stat(%s) failed: %m",
+					list_set.root_dir);
+			}
+			return NULL;
+		}
+	}
+
 	pool = pool_alloconly_create("storage", 512);
 	storage = p_new(pool, struct maildir_storage, 1);
 



More information about the dovecot-cvs mailing list