[dovecot-cvs] dovecot/src/lib-index mail-transaction-log-view.c, 1.13, 1.14

cras at procontrol.fi cras at procontrol.fi
Sun May 30 07:28:09 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv21927

Modified Files:
	mail-transaction-log-view.c 
Log Message:
assert fix



Index: mail-transaction-log-view.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- a/mail-transaction-log-view.c	28 May 2004 01:33:11 -0000	1.13
+++ b/mail-transaction-log-view.c	30 May 2004 04:28:07 -0000	1.14
@@ -88,33 +88,27 @@
 	if (view->log == NULL)
 		return -1;
 
-	ret = mail_transaction_log_file_find(view->log, min_file_seq, &file);
-	if (ret <= 0) {
-		if (ret == 0 &&
-		    min_file_seq == view->log->tail->hdr.prev_file_seq &&
-		    min_file_offset == view->log->tail->hdr.prev_file_offset) {
-			/* we can skip this */
-			min_file_seq = view->log->tail->hdr.file_seq;
-			min_file_offset =
-				sizeof(struct mail_transaction_log_header);
-			ret = mail_transaction_log_file_find(view->log,
-							     min_file_seq,
-							     &file);
+	if (min_file_seq == view->log->tail->hdr.prev_file_seq &&
+	    min_file_offset == view->log->tail->hdr.prev_file_offset) {
+		/* we can skip this */
+		min_file_seq = view->log->tail->hdr.file_seq;
+		min_file_offset = sizeof(struct mail_transaction_log_header);
+
+		if (min_file_seq > max_file_seq) {
+			/* empty view */
+			max_file_seq = min_file_seq;
+			max_file_offset = min_file_offset;
 		}
+	}
 
+	ret = mail_transaction_log_file_find(view->log, min_file_seq, &file);
+	if (ret <= 0) {
 		if (ret == 0) {
 			mail_index_set_error(view->log->index,
 				"Lost transaction log file %s seq %u",
 				view->log->tail->filepath, min_file_seq);
 		}
-		if (ret <= 0)
-			return -1;
-
-		if (min_file_seq > max_file_seq) {
-			/* empty view */
-			max_file_seq = min_file_seq;
-			max_file_offset = min_file_offset;
-		}
+		return -1;
 	}
 
 	/* check these later than others as index file may have corrupted
@@ -154,8 +148,9 @@
 			file->refcount--;
 		view->tail = first;
 	} else {
-		/* we shouldn't go backwards in log */
-		i_assert(first == view->tail);
+		/* going backwards, reference them */
+		for (file = first; file != view->tail; file = file->next)
+			file->refcount++;
 	}
 
 	/* reference all new files */



More information about the dovecot-cvs mailing list