]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
crashfix in error case
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Jun 2004 02:12:00 +0000 (05:12 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Jun 2004 02:12:00 +0000 (05:12 +0300)
--HG--
branch : HEAD

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

index 94e1e1eb879582db84885140d24c3232c15aba95..51f8ce1a9cb3c006e11493c2a4a100d4a82645f3 100644 (file)
@@ -67,7 +67,7 @@ static int mbox_sync_lock(struct mbox_sync_context *sync_ctx, int lock_type)
 {
        struct index_mailbox *ibox = sync_ctx->ibox;
        struct stat old_st, st;
-       uoff_t old_from_offset, old_offset = 0;
+       uoff_t old_from_offset = 0, old_offset = 0;
 
        if (sync_ctx->lock_id != 0) {
                if (fstat(sync_ctx->fd, &old_st) < 0) {
@@ -939,12 +939,12 @@ static int mbox_sync_update_imap_base(struct mbox_sync_context *sync_ctx)
 {
        struct mbox_sync_mail_context mail_ctx;
 
-       if (mbox_sync_check_excl_lock(sync_ctx) == -1)
-               return -1;
-
        sync_ctx->t = mail_index_transaction_begin(sync_ctx->sync_view, FALSE);
        sync_ctx->update_base_uid_last = sync_ctx->next_uid-1;
 
+       if (mbox_sync_check_excl_lock(sync_ctx) == -1)
+               return -1;
+
        mbox_sync_restart(sync_ctx);
        if (mbox_sync_loop(sync_ctx, &mail_ctx, 1) < 0)
                return -1;