[dovecot-cvs] dovecot/src/lib-index mail-index-view-sync.c, 1.16,
1.17 mail-transaction-log-view.c, 1.18, 1.19
cras at dovecot.org
cras at dovecot.org
Sun Jul 18 15:31:29 EEST 2004
Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv12460/lib-index
Modified Files:
mail-index-view-sync.c mail-transaction-log-view.c
Log Message:
Don't crash if mail_index_view_sync_next() is called again after it's finished.
Index: mail-index-view-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mail-index-view-sync.c 12 Jul 2004 11:31:34 -0000 1.16
+++ mail-index-view-sync.c 18 Jul 2004 12:31:27 -0000 1.17
@@ -71,6 +71,10 @@
return ret;
}
+#define MAIL_INDEX_VIEW_VISIBLE_SYNC_MASK \
+ (MAIL_TRANSACTION_EXPUNGE | MAIL_TRANSACTION_APPEND | \
+ MAIL_TRANSACTION_FLAG_UPDATE)
+
int mail_index_view_sync_begin(struct mail_index_view *view,
enum mail_index_sync_type sync_mask,
struct mail_index_view_sync_ctx **ctx_r)
@@ -98,10 +102,10 @@
/* only flags, appends and expunges can be left to be synced later */
want_mask = mail_transaction_type_mask_get(sync_mask);
+ i_assert((want_mask & ~MAIL_INDEX_VIEW_VISIBLE_SYNC_MASK) == 0);
mask = want_mask |
(MAIL_TRANSACTION_TYPE_MASK ^
- (MAIL_TRANSACTION_EXPUNGE | MAIL_TRANSACTION_APPEND |
- MAIL_TRANSACTION_FLAG_UPDATE));
+ MAIL_INDEX_VIEW_VISIBLE_SYNC_MASK);
if (mail_transaction_log_view_set(view->log_view,
view->log_file_seq,
@@ -177,6 +181,7 @@
if (ret < 0)
return -1;
+ ctx->hdr = NULL;
ctx->last_read = TRUE;
return 1;
}
Index: mail-transaction-log-view.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mail-transaction-log-view.c 14 Jun 2004 02:07:33 -0000 1.18
+++ mail-transaction-log-view.c 18 Jul 2004 12:31:27 -0000 1.19
@@ -235,6 +235,8 @@
for (;;) {
file = view->cur;
+ if (file == NULL)
+ return 0;
view->prev_file_seq = file->hdr.file_seq;
view->prev_file_offset = view->cur_offset;
@@ -244,9 +246,6 @@
view->cur = file->next;
view->cur_offset = sizeof(struct mail_transaction_log_header);
-
- if (view->cur == NULL)
- return 0;
}
data = buffer_get_data(file->buffer, &file_size);
More information about the dovecot-cvs
mailing list