[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.152, 1.153

tss at dovecot.org tss at dovecot.org
Tue Mar 27 22:59:33 EEST 2007


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

Modified Files:
	maildir-storage.c 
Log Message:
Disable index files if index directory can't be created.



Index: maildir-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- maildir-storage.c	15 Mar 2007 01:30:03 -0000	1.152
+++ maildir-storage.c	27 Mar 2007 19:59:28 -0000	1.153
@@ -32,7 +32,8 @@
 extern struct mail_storage maildir_storage;
 extern struct mailbox maildir_mailbox;
 
-static int verify_inbox(struct mail_storage *storage);
+static int verify_inbox(struct mail_storage *storage,
+			enum mailbox_open_flags *flags);
 
 static const char *strip_tail_slash(const char *path)
 {
@@ -141,6 +142,7 @@
 	struct index_storage *istorage;
 	struct mailbox_list_settings list_set;
 	struct mailbox_list *list;
+	enum mailbox_open_flags open_flags;
 	const char *error;
 	struct stat st;
 	pool_t pool;
@@ -193,7 +195,8 @@
 	istorage->user = p_strdup(pool, user);
 	index_storage_init(istorage, list, flags, lock_method);
 
-	(void)verify_inbox(STORAGE(storage));
+	open_flags = 0;
+	(void)verify_inbox(STORAGE(storage), &open_flags);
 	return STORAGE(storage);
 }
 
@@ -330,8 +333,10 @@
 			      mailbox_list_get_hierarchy_sep(storage->list),
 			      name);
 	if (mkdir_parents(dir, CREATE_MODE) < 0 && errno != EEXIST) {
-		mail_storage_set_critical(storage,
-					  "mkdir(%s) failed: %m", dir);
+		if (!ENOSPACE(errno)) {
+			mail_storage_set_critical(storage,
+						  "mkdir(%s) failed: %m", dir);
+		}
 		return -1;
 	}
 
@@ -361,7 +366,8 @@
 	return 0;
 }
 
-static int verify_inbox(struct mail_storage *storage)
+static int verify_inbox(struct mail_storage *storage,
+			enum mailbox_open_flags *flags)
 {
 	const char *path;
 
@@ -371,7 +377,7 @@
 		return -1;
 
 	if (create_index_dir(storage, "INBOX") < 0)
-		return -1;
+		*flags |= MAILBOX_OPEN_NO_INDEX_FILES;
 	if (create_control_dir(storage, "INBOX") < 0)
 		return -1;
 	return 0;
@@ -478,7 +484,7 @@
 	}
 
 	if (strcmp(name, "INBOX") == 0) {
-		if (verify_inbox(_storage) < 0)
+		if (verify_inbox(_storage, &flags) < 0)
 			return NULL;
 		return maildir_open(storage, "INBOX", flags);
 	}
@@ -498,7 +504,7 @@
 
 		if ((flags & MAILBOX_OPEN_NO_INDEX_FILES) == 0) {
 			if (create_index_dir(_storage, name) < 0)
-				return NULL;
+				flags |= MAILBOX_OPEN_NO_INDEX_FILES;
 		}
 
 		return maildir_open(storage, name, flags);



More information about the dovecot-cvs mailing list