]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_index_ext_resize() was broken when record_size wasn't changed.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 12 Jun 2016 17:11:49 +0000 (20:11 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 14 Jun 2016 09:25:50 +0000 (12:25 +0300)
src/lib-index/mail-index-transaction-update.c

index dff497e358f8fb34247088b88e64602cd15cee8d..784c7370b4789764da753e9e837637d2d967eaa2 100644 (file)
@@ -757,7 +757,6 @@ void mail_index_ext_resize(struct mail_index_transaction *t, uint32_t ext_id,
        if (!mail_index_map_get_ext_idx(t->view->map, ext_id, &intro.ext_id)) {
                /* have to create it */
                intro.ext_id = (uint32_t)-1;
-               old_record_size = rext->record_size;
                old_record_align = rext->record_align;
                old_header_size = rext->hdr_size;
        } else {
@@ -782,10 +781,10 @@ void mail_index_ext_resize(struct mail_index_transaction *t, uint32_t ext_id,
                old_record_size = resizes[ext_id].record_size;
        } else {
                /* use the registered values. */
-               record_size = rext->record_size;
+               old_record_size = rext->record_size;
        }
 
-       if (record_size != old_record_size) {
+       if (record_size != old_record_size && record_size != (uint16_t)-1) {
                /* if record_size grows, we'll just resize the existing
                   ext_rec_updates array. it's not possible to shrink
                   record_size without data loss. */