[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.25, 1.26

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


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

Modified Files:
	dbox-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: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dbox-storage.c	1 Dec 2006 20:55:04 -0000	1.25
+++ dbox-storage.c	3 Dec 2006 13:29:56 -0000	1.26
@@ -89,6 +89,7 @@
 	struct mailbox_list_settings list_set;
 	struct mailbox_list *list;
 	const char *error;
+	struct stat st;
 	pool_t pool;
 
 	if (dbox_get_list_settings(&list_set, data, flags) < 0)
@@ -96,6 +97,16 @@
 	list_set.mail_storage_flags = &flags;
 	list_set.mail_storage_lock_method = &lock_method;
 
+	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;
+		}
+	}
+
 	if (mkdir_parents(list_set.root_dir, CREATE_MODE) < 0 &&
 	    errno != EEXIST) {
 		i_error("mkdir_parents(%s) failed: %m", list_set.root_dir);



More information about the dovecot-cvs mailing list