[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.89,1.90
mail-index-open.c,1.33,1.34
cras at procontrol.fi
cras at procontrol.fi
Sun May 18 16:23:05 EEST 2003
Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv9067/lib-index
Modified Files:
mail-index.c mail-index-open.c
Log Message:
Misc. fixes.
Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- mail-index.c 17 May 2003 13:09:54 -0000 1.89
+++ mail-index.c 18 May 2003 12:23:03 -0000 1.90
@@ -120,7 +120,19 @@
void mail_index_close(struct mail_index *index)
{
- index->set_flags = 0;
+ if (index->set_flags != 0) {
+ if (index->header != NULL) {
+#ifdef DEBUG
+ mprotect(index->mmap_base, index->mmap_used_length,
+ PROT_READ|PROT_WRITE);
+#endif
+ index->header->flags |= index->set_flags;
+ (void)msync(index->mmap_base,
+ sizeof(struct mail_index_header), MS_SYNC);
+ }
+ index->set_flags = 0;
+ }
+
index->set_cache_fields = 0;
index->opened = FALSE;
@@ -168,11 +180,6 @@
if (index->custom_flags != NULL) {
mail_custom_flags_free(index->custom_flags);
index->custom_flags = NULL;
- }
-
- if (index->control_dir != NULL) {
- i_free(index->control_dir);
- index->control_dir = NULL;
}
if (index->error != NULL) {
Index: mail-index-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-open.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mail-index-open.c 8 May 2003 08:59:48 -0000 1.33
+++ mail-index-open.c 18 May 2003 12:23:03 -0000 1.34
@@ -286,8 +286,10 @@
index->mmap_full_length = INDEX_FILE_MIN_SIZE;
index->mmap_base = mmap_anon(index->mmap_full_length);
- if (index->mmap_base == MAP_FAILED)
+ if (index->mmap_base == MAP_FAILED) {
+ index->mmap_base = NULL;
return index_set_error(index, "mmap_anon() failed: %m");
+ }
mail_index_init_header(index, index->mmap_base);
index->header = index->mmap_base;
@@ -332,7 +334,8 @@
if ((ret = mail_index_read_header(index, &hdr)) < 0)
return FALSE;
- if (ret == 0 || !mail_index_is_compatible(&hdr)) {
+ if (ret == 0 || !mail_index_is_compatible(&hdr) ||
+ (hdr.flags & MAIL_INDEX_FLAG_REBUILD) != 0) {
if ((flags & MAIL_INDEX_OPEN_FLAG_CREATE) == 0)
return FALSE;
More information about the dovecot-cvs
mailing list