[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.15.2.6, 1.15.2.7

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


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

Modified Files:
      Tag: branch_1_0
	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.15.2.6
retrieving revision 1.15.2.7
diff -u -d -r1.15.2.6 -r1.15.2.7
--- dbox-storage.c	23 Jul 2006 14:20:58 -0000	1.15.2.6
+++ dbox-storage.c	3 Dec 2006 13:29:54 -0000	1.15.2.7
@@ -50,6 +50,7 @@
 	struct dbox_storage *storage;
 	struct index_storage *istorage;
 	const char *root_dir, *index_dir, *p;
+	struct stat st;
 	size_t len;
 	pool_t pool;
 
@@ -95,6 +96,14 @@
 	}
 
         root_dir = home_expand(root_dir);
+	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 (mkdir_parents(root_dir, CREATE_MODE) < 0 && errno != EEXIST) {
 		i_error("mkdir_parents(%s) failed: %m", root_dir);
 		return NULL;



More information about the dovecot-cvs mailing list