]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fix
authorTimo Sirainen <tss@iki.fi>
Sat, 19 Jun 2004 19:52:25 +0000 (22:52 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 19 Jun 2004 19:52:25 +0000 (22:52 +0300)
--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-sync-rewrite.c

index c3b07c7adc4ab41dd353eb520b6c46f7a4c1495f..4afe068964fcb374663b78188403822a270b40d6 100644 (file)
@@ -157,10 +157,12 @@ static void mbox_sync_header_remove_space(struct mbox_sync_mail_context *ctx,
           the beginning of header instead of end, we don't have to
           worry about multiline-headers. */
        str_delete(ctx->header, start_pos, *size);
-       last_line_pos = last_line_pos <= *size ?
-               start_pos : last_line_pos - *size;
-
+       if (last_line_pos <= start_pos + *size)
+               last_line_pos = start_pos;
+       else
+               last_line_pos -= *size;
        data_size -= *size;
+
        *size = 0;
 
        if (ctx->mail.space < data_size - last_line_pos) {
@@ -216,8 +218,6 @@ int mbox_sync_try_rewrite(struct mbox_sync_mail_context *ctx, off_t move_diff)
                if (new_hdr_size <= old_hdr_size) {
                        /* good, we removed enough. */
                        i_assert(new_hdr_size == old_hdr_size);
-                       ctx->mail.space =
-                               -(ssize_t)(new_hdr_size - old_hdr_size);
                } else if (move_diff < 0 &&
                           new_hdr_size - old_hdr_size <= -move_diff) {
                        /* moving backwards - we can use the extra space from