changeset 240:5523767c0515 HEAD

fixes
author Timo Sirainen <tss@iki.fi>
date Mon, 16 Sep 2002 07:28:13 +0300
parents 1e05ff078961
children fc8ad9d30478
files src/lib-index/mail-modifylog.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-modifylog.c	Mon Sep 16 07:22:52 2002 +0300
+++ b/src/lib-index/mail-modifylog.c	Mon Sep 16 07:28:13 2002 +0300
@@ -116,12 +116,12 @@
 	return 0;
 }
 
-static int mmap_update(MailModifyLog *log)
+static int mmap_update(MailModifyLog *log, int forced)
 {
 	ModifyLogHeader *hdr;
 	unsigned int extra;
 
-	if (log->header != NULL &&
+	if (!forced && log->header != NULL &&
 	    log->mmap_full_length >= log->header->used_file_size)
 		return TRUE;
 
@@ -321,7 +321,7 @@
 
 		if (!modifylog_open_and_init_file(log, path) ||
 		    !mail_modifylog_wait_lock(log) ||
-		    !mmap_update(log)) {
+		    !mmap_update(log, TRUE)) {
 			/* fatal failure */
 			mail_modifylog_free(log);
 			return FALSE;
@@ -429,7 +429,7 @@
 
 	if (!mail_modifylog_find_or_create(log) ||
 	    !mail_modifylog_wait_lock(log) ||
-	    !mmap_update(log)) {
+	    !mmap_update(log, TRUE)) {
 		/* fatal failure */
 		mail_modifylog_free(log);
 		return FALSE;
@@ -494,7 +494,7 @@
 		return modifylog_set_syscall_error(log, "file_set_size()");
 	}
 
-	if (!mmap_update(log))
+	if (!mmap_update(log, TRUE))
 		return FALSE;
 
 	return TRUE;
@@ -526,8 +526,8 @@
 	}
 
 	i_assert(log->header->used_file_size == log->mmap_used_length);
-	i_assert(log->mmap_used_length <=
-		 log->mmap_full_length - sizeof(ModifyLogRecord));
+	i_assert(log->mmap_used_length + sizeof(ModifyLogRecord) <=
+		 log->mmap_full_length);
 
 	destrec = (ModifyLogRecord *) ((char *) log->mmap_base +
 				       log->mmap_used_length);
@@ -580,7 +580,7 @@
 	i_assert(log->index->lock_type != MAIL_LOCK_UNLOCK);
 
 	*count = 0;
-	if (!mmap_update(log))
+	if (!mmap_update(log, FALSE))
 		return NULL;
 
 	i_assert(log->synced_position <= log->mmap_used_length);
@@ -616,7 +616,7 @@
 {
 	i_assert(log->index->lock_type != MAIL_LOCK_UNLOCK);
 
-	if (!mmap_update(log))
+	if (!mmap_update(log, FALSE))
 		return FALSE;
 
 	if (log->header->sync_id == SYNC_ID_FULL) {
@@ -664,7 +664,7 @@
 
 	*expunges_before = 0;
 
-	if (!mmap_update(log))
+	if (!mmap_update(log, FALSE))
 		return NULL;
 
 	/* find the first expunged message that affects our range */
@@ -746,7 +746,7 @@
 
 	i_assert(log->index->lock_type != MAIL_LOCK_UNLOCK);
 
-	if (!mmap_update(log))
+	if (!mmap_update(log, FALSE))
 		return NULL;
 
 	/* find the first expunged message that affects our range */