[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.115.2.13, 1.115.2.14

tss at dovecot.org tss at dovecot.org
Sun Dec 3 13:29:57 UTC 2006


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

Modified Files:
      Tag: branch_1_0
	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.115.2.13
retrieving revision 1.115.2.14
diff -u -d -r1.115.2.13 -r1.115.2.14
--- maildir-storage.c	15 Nov 2006 14:22:31 -0000	1.115.2.13
+++ maildir-storage.c	3 Dec 2006 13:29:55 -0000	1.115.2.14
@@ -66,6 +66,7 @@
 	struct index_storage *istorage;
 	const char *root_dir, *inbox_dir, *index_dir, *control_dir;
 	const char *home, *path, *p;
+	struct stat st;
 	size_t len;
 	pool_t pool;
 
@@ -137,6 +138,15 @@
 	if (root_dir[len-1] == '/')
 		root_dir = t_strndup(root_dir, len-1);
 
+	/* normally the maildir is created in verify_inbox() */
+	if ((flags & MAIL_STORAGE_FLAG_NO_AUTOCREATE) != 0) {
+		if (stat(root_dir, &st) < 0) {
+			if (errno != ENOENT)
+				i_error("stat(%s) failed: %m", root_dir);
+			return NULL;
+		}
+	}
+
 	if (index_dir == NULL)
 		index_dir = root_dir;
 	else if (strcmp(index_dir, "MEMORY") == 0)



More information about the dovecot-cvs mailing list