[dovecot-cvs] dovecot/src/lib-storage/index/mbox
mbox-sync-rewrite.c, 1.38, 1.39 mbox-sync.c, 1.111, 1.112
cras at dovecot.org
cras at dovecot.org
Tue Oct 26 00:55:17 EEST 2004
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv24797/lib-storage/index/mbox
Modified Files:
mbox-sync-rewrite.c mbox-sync.c
Log Message:
Expunge sync fix
Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mbox-sync-rewrite.c 22 Oct 2004 00:48:44 -0000 1.38
+++ mbox-sync-rewrite.c 25 Oct 2004 21:55:15 -0000 1.39
@@ -396,6 +396,7 @@
size_t size;
int ret = 0;
+ i_assert(extra_space < OFF_T_MAX);
i_assert(sync_ctx->ibox->mbox_lock_type == F_WRLCK);
mails = buffer_get_modifyable_data(sync_ctx->mails, &size);
Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- mbox-sync.c 25 Oct 2004 21:13:20 -0000 1.111
+++ mbox-sync.c 25 Oct 2004 21:55:15 -0000 1.112
@@ -603,7 +603,7 @@
mbox_sync_handle_missing_space(struct mbox_sync_mail_context *mail_ctx)
{
struct mbox_sync_context *sync_ctx = mail_ctx->sync_ctx;
- uoff_t end_offset, move_diff, extra_space, needed_space;
+ uoff_t end_offset, move_diff, extra_space;
uint32_t last_seq;
buffer_append(sync_ctx->mails, &mail_ctx->mail, sizeof(mail_ctx->mail));
@@ -623,14 +623,14 @@
/* this message was expunged. fill more or less of the space. */
extra_space = MBOX_HEADER_PADDING *
(sync_ctx->seq - sync_ctx->need_space_seq + 1);
- needed_space = mail_ctx->mail.space - sync_ctx->space_diff;
- if ((uoff_t)sync_ctx->space_diff > needed_space + extra_space) {
+ if ((uoff_t)sync_ctx->space_diff > extra_space) {
/* don't waste too much on padding */
- sync_ctx->expunged_space = mail_ctx->mail.space -
- (needed_space + extra_space);
- sync_ctx->space_diff = needed_space + extra_space;
+ i_assert(mail_ctx->mail.space > (off_t)extra_space);
+ sync_ctx->expunged_space =
+ mail_ctx->mail.space - extra_space;
+ sync_ctx->space_diff = extra_space;
} else {
- extra_space = sync_ctx->space_diff - needed_space;
+ extra_space = sync_ctx->space_diff;
}
last_seq = sync_ctx->seq - 1;
buffer_set_used_size(sync_ctx->mails, sync_ctx->mails->used -
More information about the dovecot-cvs
mailing list