[prev in list] [next in list] [prev in thread] [next in thread]
List: dovecot-cvs
Subject: [dovecot-cvs] dovecot/src/lib-index mail-index.c,1.173,1.174
From: cras () dovecot ! org (cras () dovecot ! org)
Date: 2004-11-30 10:59:32
Message-ID: 20041130085929.E88FEC000D98 () talvi ! dovecot ! org
[Download RAW message or body]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv17926/lib-index
Modified Files:
mail-index.c
Log Message:
With mmap_disabled=no the index header wasn't always updated causing various
problems.
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- mail-index.c 29 Nov 2004 18:01:26 -0000 1.173
+++ mail-index.c 30 Nov 2004 08:59:26 -0000 1.174
@@ -371,6 +371,19 @@
mail_index_unmap(index, map);
}
+static void mail_index_map_copy_hdr(struct mail_index_map *map,
+ const struct mail_index_header *hdr)
+{
+ if (hdr->base_header_size < sizeof(map->hdr)) {
+ /* header smaller than ours, make a copy so our newer headers
+ won't have garbage in them */
+ memset(&map->hdr, 0, sizeof(map->hdr));
+ memcpy(&map->hdr, hdr, hdr->base_header_size);
+ } else {
+ map->hdr = *hdr;
+ }
+}
+
static int mail_index_mmap(struct mail_index *index, struct mail_index_map *map)
{
const struct mail_index_header *hdr;
@@ -421,14 +434,7 @@
return 0;
}
- if (hdr->base_header_size < sizeof(map->hdr)) {
- /* header smaller than ours, make a copy so our newer headers
- won't have garbage in them */
- memset(&map->hdr, 0, sizeof(map->hdr));
- memcpy(&map->hdr, hdr, hdr->base_header_size);
- } else {
- map->hdr = *hdr;
- }
+ mail_index_map_copy_hdr(map, hdr);
map->hdr_base = map->mmap_base;
map->records = PTR_OFFSET(map->mmap_base, map->hdr.header_size);
@@ -531,12 +537,7 @@
map->records = data;
map->records_count = hdr.messages_count;
- if (hdr.base_header_size >= sizeof(map->hdr))
- map->hdr = hdr;
- else {
- memset(&map->hdr, 0, sizeof(map->hdr));
- memcpy(&map->hdr, &hdr, hdr.base_header_size);
- }
+ mail_index_map_copy_hdr(map, &hdr);
map->hdr_base = map->hdr_copy_buf->data;
index->sync_log_file_seq = hdr.log_file_seq;
@@ -698,6 +699,7 @@
used_size = hdr->header_size + hdr->messages_count * hdr->record_size;
if (map->mmap_size >= used_size && map->hdr_base == hdr) {
map->records_count = hdr->messages_count;
+ mail_index_map_copy_hdr(map, hdr);
return 1;
}
return 0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic