]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't crash if there was locking problems when trying to rewrite mbox.
authorTimo Sirainen <tss@iki.fi>
Sun, 13 Apr 2003 18:01:25 +0000 (21:01 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 13 Apr 2003 18:01:25 +0000 (21:01 +0300)
--HG--
branch : HEAD

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

index 3c53c5b49f58e6cd894b139a2e33772168afb449..dc20f8b8dfbe798024d357d43f73946c65fdf3aa 100644 (file)
@@ -217,9 +217,13 @@ static int dotlock_callback(unsigned int secs_left, int stale, void *context)
        }
        ctx->last_stale = stale;
 
-       ctx->index->lock_notify_cb(stale ? MAIL_LOCK_NOTIFY_MAILBOX_OVERRIDE :
-                                  MAIL_LOCK_NOTIFY_MAILBOX_ABORT,
-                                  secs_left, ctx->index->lock_notify_context);
+       if (ctx->index->lock_notify_cb != NULL) {
+               ctx->index->lock_notify_cb(stale ?
+                                          MAIL_LOCK_NOTIFY_MAILBOX_OVERRIDE :
+                                          MAIL_LOCK_NOTIFY_MAILBOX_ABORT,
+                                          secs_left,
+                                          ctx->index->lock_notify_context);
+       }
        return TRUE;
 }
 
index 9ce2d4e06d43aae319fe6f9bfb3e03e18d16ce20..1141ce2c15728c060b7de489405b7217c9dded79 100644 (file)
@@ -647,10 +647,12 @@ static int mbox_storage_close(struct mailbox *box)
        int failed = FALSE;
 
        /* update flags by rewrite mbox file */
+        index_storage_init_lock_notify(ibox);
        if (!mbox_index_rewrite(ibox->index)) {
                mail_storage_set_index_error(ibox);
                failed = TRUE;
        }
+       ibox->index->set_lock_notify_callback(ibox->index, NULL, NULL);
 
        return index_storage_close(box) && !failed;
 }