dovecot-1.0: When trying to use mbox file as the root directory,...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 14 05:31:08 EEST 2007


details:   http://hg.dovecot.org/dovecot-1.0/rev/3099b59226af
changeset: 5311:3099b59226af
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 14 05:31:03 2007 +0300
description:
When trying to use mbox file as the root directory, give a nice error.

diffstat:

1 file changed, 8 insertions(+), 1 deletion(-)
src/lib-storage/index/mbox/mbox-storage.c |    9 ++++++++-

diffs (19 lines):

diff -r 60d840dc718e -r 3099b59226af src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 14 02:11:16 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 14 05:31:03 2007 +0300
@@ -532,7 +532,14 @@ static int verify_inbox(struct index_sto
 	fd = open(storage->inbox_path, O_RDWR | O_CREAT | O_EXCL, 0660);
 	if (fd != -1)
 		(void)close(fd);
-	else if (errno != EEXIST) {
+	else if (errno == ENOTDIR &&
+		 strncmp(storage->inbox_path, storage->dir,
+			 strlen(storage->dir)) == 0) {
+		mail_storage_set_critical(&storage->storage,
+			"mbox root directory can't be a file: %s "
+			"(http://wiki.dovecot.org/MailLocation/Mbox)",
+			storage->dir);
+	} else if (errno != EEXIST) {
 		mail_storage_set_critical(&storage->storage,
 			"open(%s, O_CREAT) failed: %m", storage->inbox_path);
 	}


More information about the dovecot-cvs mailing list