[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c, 1.184, 1.185

tss at dovecot.org tss at dovecot.org
Sun May 13 21:28:47 EEST 2007


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

Modified Files:
	mbox-storage.c 
Log Message:
Moved index directory creation code to index_storage_alloc().



Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- mbox-storage.c	13 May 2007 17:10:55 -0000	1.184
+++ mbox-storage.c	13 May 2007 18:28:43 -0000	1.185
@@ -444,27 +444,6 @@
 	return 0;
 }
 
-static int create_mbox_index_dirs(struct mail_storage *storage,
-				  const char *name)
-{
-	const char *index_dir;
-
-	index_dir = mailbox_list_get_path(storage->list, name,
-					  MAILBOX_LIST_PATH_TYPE_INDEX);
-	if (*index_dir == '\0')
-		return 0;
-
-	if (mkdir_parents(index_dir, CREATE_MODE) < 0) {
-		if (!ENOSPACE(errno)) {
-			mail_storage_set_critical(storage,
-				"mkdir_parents(%s) failed: %m", index_dir);
-		}
-		return -1;
-	}
-
-	return 0;
-}
-
 static int verify_inbox(struct mail_storage *storage)
 {
 	const char *inbox_path;
@@ -574,23 +553,12 @@
 	struct mail_storage *_storage = &storage->storage;
 	struct mbox_mailbox *mbox;
 	struct mail_index *index;
-	const char *path, *index_dir;
+	const char *path;
 
 	path = mailbox_list_get_path(_storage->list, name,
 				     MAILBOX_LIST_PATH_TYPE_MAILBOX);
-	index_dir = mailbox_list_get_path(_storage->list, name,
-					  MAILBOX_LIST_PATH_TYPE_INDEX);
 
-	if ((flags & MAILBOX_OPEN_NO_INDEX_FILES) != 0)
-		index_dir = "";
-
-	if (*index_dir != '\0') {
-		/* make sure the index directories exist */
-		if (create_mbox_index_dirs(_storage, name) < 0)
-			index_dir = "";
-	}
-
-	index = index_storage_alloc(index_dir, path, MBOX_INDEX_PREFIX);
+	index = index_storage_alloc(_storage, name, flags, MBOX_INDEX_PREFIX);
 	mbox = mbox_alloc_mailbox(storage, index, name, path, flags);
 
 	if (access(path, R_OK|W_OK) < 0) {
@@ -612,24 +580,13 @@
 	struct mail_storage *_storage = &storage->storage;
 	struct mail_index *index;
 	struct mbox_mailbox *mbox;
-	const char *path, *index_dir;
+	const char *path;
 
 	flags |= MAILBOX_OPEN_READONLY;
 
 	path = mailbox_list_get_path(_storage->list, name,
 				     MAILBOX_LIST_PATH_TYPE_MAILBOX);
-	if ((flags & MAILBOX_OPEN_NO_INDEX_FILES) != 0)
-		index_dir = "";
-	else {
-		index_dir = mailbox_list_get_path(_storage->list, name,
-						  MAILBOX_LIST_PATH_TYPE_INDEX);
-
-		/* make sure the required directories are also there */
-		if (create_mbox_index_dirs(_storage, name) < 0)
-			index_dir = "";
-	}
-
-	index = index_storage_alloc(index_dir, path, MBOX_INDEX_PREFIX);
+	index = index_storage_alloc(_storage, name, flags, MBOX_INDEX_PREFIX);
 	mbox = mbox_alloc_mailbox(storage, index, name, path, flags);
 	if (mbox == NULL)
 		return NULL;



More information about the dovecot-cvs mailing list