[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-list.c, 1.35, 1.36

cras at dovecot.org cras at dovecot.org
Thu Jul 21 22:16:32 EEST 2005


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

Modified Files:
	maildir-list.c 
Log Message:
Give error message if mailbox listing fails. Don't crash with mbox if
.subscriptions file couldn't be opened.



Index: maildir-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-list.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- maildir-list.c	8 Apr 2005 14:32:51 -0000	1.35
+++ maildir-list.c	21 Jul 2005 19:16:30 -0000	1.36
@@ -66,8 +66,9 @@
 		if (errno != ENOENT) {
 			mail_storage_set_critical(ctx->mailbox_ctx.storage,
 				"opendir(%s) failed: %m", ctx->dir);
+			return FALSE;
 		}
-		return FALSE;
+		return TRUE;
 	}
 
 	stat_dirs = getenv("MAILDIR_STAT_DIRS") != NULL;
@@ -286,8 +287,10 @@
 	ctx->prefix = "";
 
 	if ((flags & MAILBOX_LIST_SUBSCRIBED) != 0) {
-		if (!maildir_fill_subscribed(ctx, glob))
+		if (!maildir_fill_subscribed(ctx, glob)) {
+			ctx->failed = TRUE;
 			return &ctx->mailbox_ctx;
+		}
 	} else if ((storage->flags & MAIL_STORAGE_FLAG_FULL_FS_ACCESS) != 0 &&
 		   (p = strrchr(mask, '/')) != NULL) {
 		dir = t_strdup_until(mask, p);
@@ -301,8 +304,10 @@
 	if ((flags & MAILBOX_LIST_SUBSCRIBED) == 0 ||
 	    (ctx->flags & MAILBOX_LIST_FAST_FLAGS) == 0) {
 		int update_only = (flags & MAILBOX_LIST_SUBSCRIBED) != 0;
-		if (!maildir_fill_readdir(ctx, glob, update_only))
+		if (!maildir_fill_readdir(ctx, glob, update_only)) {
+			ctx->failed = TRUE;
 			return &ctx->mailbox_ctx;
+		}
 	}
 
 	ctx->node_path = str_new(pool, 256);
@@ -314,10 +319,11 @@
 int maildir_mailbox_list_deinit(struct mailbox_list_context *_ctx)
 {
 	struct maildir_list_context *ctx = (struct maildir_list_context *)_ctx;
+	int ret = ctx->failed ? -1 : 0;
 
 	mailbox_tree_deinit(ctx->tree_ctx);
 	pool_unref(ctx->pool);
-	return TRUE;
+	return ret;
 }
 
 static struct mailbox_node *find_next(struct mailbox_node **node,



More information about the dovecot-cvs mailing list