From: Timo Sirainen Date: Sun, 13 Apr 2003 18:01:25 +0000 (+0300) Subject: Don't crash if there was locking problems when trying to rewrite mbox. X-Git-Tag: 1.1.alpha1~4751 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a3bca3dfe50db275bdad9a1f43482971f4c9742;p=thirdparty%2Fdovecot%2Fcore.git Don't crash if there was locking problems when trying to rewrite mbox. --HG-- branch : HEAD --- diff --git a/src/lib-index/mbox/mbox-lock.c b/src/lib-index/mbox/mbox-lock.c index 3c53c5b49f..dc20f8b8df 100644 --- a/src/lib-index/mbox/mbox-lock.c +++ b/src/lib-index/mbox/mbox-lock.c @@ -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; } diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index 9ce2d4e06d..1141ce2c15 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -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; }