From: Timo Sirainen Date: Sat, 22 Nov 2008 23:59:35 +0000 (+0200) Subject: Fix to previous search_next_update_seq change. X-Git-Tag: 1.2.alpha4~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cb6b8ee7ac4dec74fd93bf6a2caf397983f7407;p=thirdparty%2Fdovecot%2Fcore.git Fix to previous search_next_update_seq change. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-search.c b/src/lib-storage/index/index-search.c index 311f0c7787..3408ed921d 100644 --- a/src/lib-storage/index/index-search.c +++ b/src/lib-storage/index/index-search.c @@ -1164,7 +1164,7 @@ int index_storage_search_next_nonblock(struct mail_search_context *_ctx, struct index_search_context *ctx = (struct index_search_context *)_ctx; struct mailbox *box = _ctx->transaction->box; unsigned int count = 0; - bool match, never; + bool match = FALSE, never; *tryagain_r = FALSE; @@ -1236,7 +1236,7 @@ int index_storage_search_next_nonblock(struct mail_search_context *_ctx, ctx->mail = NULL; ctx->imail = NULL; - if (_ctx->sort_program != NULL && !ctx->failed) { + if (!match && _ctx->sort_program != NULL && !ctx->failed) { /* finished searching the messages. now sort them and start returning the messages. */ ctx->sorted = TRUE; @@ -1245,7 +1245,7 @@ int index_storage_search_next_nonblock(struct mail_search_context *_ctx, tryagain_r); } - return ctx->failed ? -1 : 0; + return ctx->failed ? -1 : (match ? 1 : 0); } bool index_storage_search_next_update_seq(struct mail_search_context *_ctx)