dovecot-2.0: dsync: Potential crashfix, plus some compiler warni...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 1 20:29:25 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/9798d57644ba
changeset: 11684:9798d57644ba
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 01 18:29:06 2010 +0100
description:
dsync: Potential crashfix, plus some compiler warning fixes.

diffstat:

 src/dsync/dsync-brain.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 148fccbe9f32 -r 9798d57644ba src/dsync/dsync-brain.c
--- a/src/dsync/dsync-brain.c	Thu Jul 01 18:12:49 2010 +0100
+++ b/src/dsync/dsync-brain.c	Thu Jul 01 18:29:06 2010 +0100
@@ -289,10 +289,11 @@
 
 static void dsync_brain_sync_mailboxes(struct dsync_brain *brain)
 {
-	struct dsync_mailbox *const *src_boxes, *const *dest_boxes, *action_box;
+	struct dsync_mailbox *const *src_boxes, *const *dest_boxes;
+	struct dsync_mailbox *action_box = NULL;
+	struct dsync_worker *action_worker = NULL;
 	unsigned int src, dest, src_count, dest_count;
 	enum dsync_brain_mailbox_action action;
-	struct dsync_worker *action_worker;
 	bool src_deleted, dest_deleted;
 	int ret;
 
@@ -369,7 +370,7 @@
 	struct dsync_mailbox *const *src_boxes, *const *dest_boxes, *action_box;
 	unsigned int src, dest, src_count, dest_count;
 	enum dsync_brain_mailbox_action action;
-	struct dsync_worker *action_worker;
+	struct dsync_worker *action_worker = NULL;
 	bool src_deleted, dest_deleted;
 	int ret;
 
@@ -378,6 +379,8 @@
 	dest_boxes = array_get(&brain->dest_mailbox_list->dirs, &dest_count);
 	for (src = dest = 0; src < src_count && dest < dest_count; ) {
 		action = DSYNC_BRAIN_MAILBOX_ACTION_NONE;
+		action_box = NULL;
+
 		src_deleted = (src_boxes[src]->flags &
 			       DSYNC_MAILBOX_FLAG_DELETED_DIR) != 0;
 		dest_deleted = (dest_boxes[dest]->flags &
@@ -418,7 +421,8 @@
 		} else {
 			src++; dest++;
 		}
-		i_assert(dsync_mailbox_is_noselect(action_box));
+		i_assert(action_box == NULL ||
+			 dsync_mailbox_is_noselect(action_box));
 		dsync_brain_mailbox_action(brain, action,
 					   action_worker, action_box);
 	}


More information about the dovecot-cvs mailing list