]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fix to previous search_next_update_seq change.
authorTimo Sirainen <tss@iki.fi>
Sat, 22 Nov 2008 23:59:35 +0000 (01:59 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 22 Nov 2008 23:59:35 +0000 (01:59 +0200)
--HG--
branch : HEAD

src/lib-storage/index/index-search.c

index 311f0c77872c5f977fc19c08ebe73a03a1c292ed..3408ed921de74efb231c2c5aacb69c408d097ab8 100644 (file)
@@ -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)