Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/lib-index/mail-index.c @ 3912:fc0b638330a4 HEAD
Added mbox_min_index_size setting.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 19 Jan 2006 01:14:43 +0200 |
parents | 3a2fe49912f3 |
children | b19ccbaa3802 |
comparison
equal
deleted
inserted
replaced
3911:3a2fe49912f3 | 3912:fc0b638330a4 |
---|---|
1391 ret = mail_index_try_open(index, &lock_id); | 1391 ret = mail_index_try_open(index, &lock_id); |
1392 if (ret > 0) | 1392 if (ret > 0) |
1393 hdr = *index->hdr; | 1393 hdr = *index->hdr; |
1394 else if (ret == 0) { | 1394 else if (ret == 0) { |
1395 /* doesn't exist, or corrupted */ | 1395 /* doesn't exist, or corrupted */ |
1396 if ((flags & MAIL_INDEX_OPEN_FLAG_CREATE) == 0) | 1396 if ((flags & MAIL_INDEX_OPEN_FLAG_CREATE) == 0 && |
1397 !MAIL_INDEX_IS_IN_MEMORY(index)) | |
1397 return 0; | 1398 return 0; |
1398 mail_index_header_init(&hdr); | 1399 mail_index_header_init(&hdr); |
1399 index->hdr = &hdr; | 1400 index->hdr = &hdr; |
1400 } else if (ret < 0) | 1401 } else if (ret < 0) |
1401 return -1; | 1402 return -1; |
1699 int ret = 0; | 1700 int ret = 0; |
1700 | 1701 |
1701 /* set the index as being into memory */ | 1702 /* set the index as being into memory */ |
1702 i_free_and_null(index->dir); | 1703 i_free_and_null(index->dir); |
1703 | 1704 |
1705 if (index->map == NULL) { | |
1706 /* mbox file was never even opened. just mark it as being in | |
1707 memory and let the caller re-open the index. */ | |
1708 i_assert(index->fd == -1); | |
1709 return -1; | |
1710 } | |
1711 | |
1704 /* move index map to memory */ | 1712 /* move index map to memory */ |
1705 map = mail_index_map_clone(index->map, index->map->hdr.record_size); | 1713 map = mail_index_map_clone(index->map, index->map->hdr.record_size); |
1706 mail_index_unmap(index, &index->map); | 1714 mail_index_unmap(index, &index->map); |
1707 index->map = map; | 1715 index->map = map; |
1708 index->hdr = &map->hdr; | 1716 index->hdr = &map->hdr; |