[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.115.2.26, 1.115.2.27

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


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

Modified Files:
      Tag: branch_1_0
	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.115.2.26
retrieving revision 1.115.2.27
diff -u -d -r1.115.2.26 -r1.115.2.27
--- maildir-storage.c	6 Mar 2007 15:39:01 -0000	1.115.2.26
+++ maildir-storage.c	27 Mar 2007 19:59:25 -0000	1.115.2.27
@@ -35,7 +35,8 @@
 extern struct mail_storage maildir_storage;
 extern struct mailbox maildir_mailbox;
 
-static int verify_inbox(struct maildir_storage *storage);
+static int verify_inbox(struct maildir_storage *storage,
+			enum mailbox_open_flags *flags);
 
 static void maildir_subscriptions_convert_099(struct maildir_storage *storage)
 {
@@ -65,6 +66,7 @@
 	struct index_storage *istorage;
 	const char *root_dir, *inbox_dir, *index_dir, *control_dir;
 	const char *home, *path, *p;
+	enum mailbox_open_flags open_flags;
 	struct stat st;
 	size_t len;
 	pool_t pool;
@@ -183,7 +185,8 @@
 
 	maildir_subscriptions_convert_099(storage);
 
-	(void)verify_inbox(storage);
+	open_flags = 0;
+	(void)verify_inbox(storage, &open_flags);
 	return STORAGE(storage);
 }
 
@@ -421,8 +424,10 @@
 
 	dir = t_strconcat(storage->index_dir, "/"MAILDIR_FS_SEP_S, name, NULL);
 	if (mkdir_parents(dir, CREATE_MODE) < 0 && errno != EEXIST) {
-		mail_storage_set_critical(&storage->storage,
-					  "mkdir(%s) failed: %m", dir);
+		if (!ENOSPACE(errno)) {
+			mail_storage_set_critical(&storage->storage,
+						  "mkdir(%s) failed: %m", dir);
+		}
 		return -1;
 	}
 
@@ -447,7 +452,8 @@
 	return 0;
 }
 
-static int verify_inbox(struct maildir_storage *storage)
+static int verify_inbox(struct maildir_storage *storage,
+			enum mailbox_open_flags *flags)
 {
 	struct index_storage *istorage = INDEX_STORAGE(storage);
 	const char *path;
@@ -460,7 +466,7 @@
 
 	/* make sure the index directories exist */
 	if (create_index_dir(istorage, "INBOX") < 0)
-		return -1;
+		*flags |= MAILBOX_OPEN_NO_INDEX_FILES;
 	if (create_control_dir(storage, "INBOX") < 0)
 		return -1;
 	return 0;
@@ -592,7 +598,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);
 	}
@@ -611,7 +617,7 @@
 
 		if ((flags & MAILBOX_OPEN_NO_INDEX_FILES) == 0) {
 			if (create_index_dir(istorage, name) < 0)
-				return NULL;
+				flags |= MAILBOX_OPEN_NO_INDEX_FILES;
 		}
 
 		return maildir_open(storage, name, flags);



More information about the dovecot-cvs mailing list