Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5323:5c8f84bc07b1 HEAD
Error handling fixes
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Mar 2007 14:04:45 +0200 |
parents | 00ca0fdc703c |
children | 4d3294c59939 |
files | src/lib-index/mail-index.c src/lib-index/mailbox-list-index-sync.c src/lib-index/mailbox-list-index.c |
diffstat | 3 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Thu Mar 15 13:48:05 2007 +0200 +++ b/src/lib-index/mail-index.c Thu Mar 15 14:04:45 2007 +0200 @@ -1727,8 +1727,9 @@ i_assert(index->excl_lock_count == 0); old_map = index->map; + if (old_map != NULL) + old_map->refcount++; old_fd = index->fd; - old_map->refcount++; /* new file, new locks. the old fd can keep its locks, they don't matter anymore as no-one's going to modify the file. */ @@ -1768,7 +1769,8 @@ mail_index_unlock(index, lock_id); if (ret == 0) { - mail_index_unmap(index, &old_map); + if (old_map != NULL) + mail_index_unmap(index, &old_map); if (old_file_lock != NULL) file_lock_free(&old_file_lock); if (close(old_fd) < 0)
--- a/src/lib-index/mailbox-list-index-sync.c Thu Mar 15 13:48:05 2007 +0200 +++ b/src/lib-index/mailbox-list-index-sync.c Thu Mar 15 14:04:45 2007 +0200 @@ -831,7 +831,7 @@ ret = mailbox_list_index_compress(ctx); } - if (ctx->mail_sync_ctx != NULL) { + if (ctx->trans != NULL) { if (ret < 0) mail_index_transaction_rollback(&ctx->trans); else { @@ -842,7 +842,8 @@ &seq, &offset) < 0) ret = -1; } - + } + if (ctx->mail_sync_ctx != NULL) { if (ret < 0) mail_index_sync_rollback(&ctx->mail_sync_ctx); else {
--- a/src/lib-index/mailbox-list-index.c Thu Mar 15 13:48:05 2007 +0200 +++ b/src/lib-index/mailbox-list-index.c Thu Mar 15 14:04:45 2007 +0200 @@ -126,7 +126,9 @@ if (hdr->uid_validity != index->mail_index->hdr->uid_validity && index->mail_index->hdr->uid_validity != 0) { mail_index_set_error(index->mail_index, - "uid_validity changed in file %s", index->filepath); + "uid_validity changed in file %s: %u -> %u", + index->filepath, index->mail_index->hdr->uid_validity, + hdr->uid_validity); mail_index_mark_corrupted(index->mail_index); return -1; }