dovecot-1.2: sort indexes: One more assert-crashfix when renumbe...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 5 18:24:52 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/7e3590da43a9
changeset: 8070:7e3590da43a9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 05 11:24:29 2008 -0400
description:
sort indexes: One more assert-crashfix when renumbering sort IDs.

diffstat:

1 file changed, 8 insertions(+), 5 deletions(-)
src/lib-storage/index/index-sort-string.c |   13 ++++++++-----

diffs (23 lines):

diff -r 6396a64b0fcb -r 7e3590da43a9 src/lib-storage/index/index-sort-string.c
--- a/src/lib-storage/index/index-sort-string.c	Mon Aug 04 20:34:35 2008 -0400
+++ b/src/lib-storage/index/index-sort-string.c	Tue Aug 05 11:24:29 2008 -0400
@@ -516,11 +516,14 @@ index_sort_add_ids_range(struct sort_str
 		/* we most likely don't have enough space. we have to
 		   renumber some of the existing sort IDs. do this by
 		   widening the area we're giving sort IDs. */
-		if (left_idx > 0) {
-			left_sort_id = nodes[--left_idx].sort_id;
-			if (left_sort_id == 0) {
-				i_assert(left_idx == 0);
-				left_sort_id = 1;
+		while (left_idx > 0) {
+			if (nodes[--left_idx].sort_id != left_sort_id) {
+				left_sort_id = nodes[left_idx].sort_id;
+				if (left_sort_id == 0) {
+					i_assert(left_idx == 0);
+					left_sort_id = 1;
+				}
+				break;
 			}
 		}
 


More information about the dovecot-cvs mailing list