Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mail-index.c @ 1945:268a4096e8be HEAD
cleanup
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 01 May 2004 19:42:10 +0300 |
parents | e473d2df21be |
children | dbec6c9dbffa |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Sat May 01 19:30:58 2004 +0300 +++ b/src/lib-index/mail-index.c Sat May 01 19:42:10 2004 +0300 @@ -655,32 +655,30 @@ index->indexid = 0; } -int mail_index_mark_corrupted(struct mail_index *index) +void mail_index_mark_corrupted(struct mail_index *index) { struct mail_index_header hdr; + mail_index_set_inconsistent(index); + if (index->readonly) - return 0; + return; /* make sure we can write the header */ if (!MAIL_INDEX_MAP_IS_IN_MEMORY(index->map)) { if (mprotect(index->map->mmap_base, sizeof(hdr), PROT_READ | PROT_WRITE) < 0) { mail_index_set_syscall_error(index, "mprotect()"); - return -1; + return; } } hdr = *index->hdr; hdr.flags |= MAIL_INDEX_HDR_FLAG_CORRUPTED; - if (mail_index_write_header(index, &hdr) < 0) - return -1; - - if (fsync(index->fd) < 0) - return mail_index_set_syscall_error(index, "fsync()"); - - mail_index_set_inconsistent(index); - return 0; + if (mail_index_write_header(index, &hdr) == 0) { + if (fsync(index->fd) < 0) + mail_index_set_syscall_error(index, "fsync()"); + } } int mail_index_set_syscall_error(struct mail_index *index,