dovecot-2.2: fts: Crashfix when FTS isn't needed for performing ...
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 20 03:26:27 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/63f3bb8462b4
changeset: 14328:63f3bb8462b4
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 12 14:32:23 2012 +0200
description:
fts: Crashfix when FTS isn't needed for performing search.
diffstat:
src/plugins/fts/fts-storage.c | 57 +++++++++++++++++++++---------------------
1 files changed, 28 insertions(+), 29 deletions(-)
diffs (76 lines):
diff -r 4dd97a92691a -r 63f3bb8462b4 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c Mon Mar 12 13:45:19 2012 +0200
+++ b/src/plugins/fts/fts-storage.c Mon Mar 12 14:32:23 2012 +0200
@@ -206,30 +206,26 @@
enum mail_error error;
int ret;
- if (fctx == NULL)
- return TRUE;
+ ret = fts_indexer_more(fctx->indexer_ctx);
+ if (ret == 0)
+ return FALSE;
- if (fctx->indexer_ctx != NULL) {
- /* this command is still building the indexes */
- ret = fts_indexer_more(fctx->indexer_ctx);
- if (ret == 0)
- return FALSE;
- ctx->progress_hidden = FALSE;
- if (fts_indexer_deinit(&fctx->indexer_ctx) < 0)
- ret = -1;
- if (ret > 0)
- fts_search_lookup(fctx);
- if (ret < 0) {
- /* if indexing timed out, it probably means that
- the mailbox is still being indexed, but it's a large
- mailbox and it takes a while. in this situation
- we'll simply abort the search.
+ /* indexing finished */
+ ctx->progress_hidden = FALSE;
+ if (fts_indexer_deinit(&fctx->indexer_ctx) < 0)
+ ret = -1;
+ if (ret > 0)
+ fts_search_lookup(fctx);
+ if (ret < 0) {
+ /* if indexing timed out, it probably means that
+ the mailbox is still being indexed, but it's a large
+ mailbox and it takes a while. in this situation
+ we'll simply abort the search.
- if indexing failed for any other reason, just
- fallback to searching the slow way. */
- (void)mailbox_get_last_error(fctx->box, &error);
- fctx->indexing_timed_out = error == MAIL_ERROR_INUSE;
- }
+ if indexing failed for any other reason, just
+ fallback to searching the slow way. */
+ (void)mailbox_get_last_error(fctx->box, &error);
+ fctx->indexing_timed_out = error == MAIL_ERROR_INUSE;
}
return TRUE;
}
@@ -241,13 +237,16 @@
struct fts_mailbox *fbox = FTS_CONTEXT(ctx->transaction->box);
struct fts_search_context *fctx = FTS_CONTEXT(ctx);
- if (!fts_mailbox_build_continue(ctx)) {
- *tryagain_r = TRUE;
- return FALSE;
- }
- if (fctx->indexing_timed_out) {
- *tryagain_r = FALSE;
- return FALSE;
+ if (fctx != NULL && fctx->indexer_ctx != NULL) {
+ /* this command is still building the indexes */
+ if (!fts_mailbox_build_continue(ctx)) {
+ *tryagain_r = TRUE;
+ return FALSE;
+ }
+ if (fctx->indexing_timed_out) {
+ *tryagain_r = FALSE;
+ return FALSE;
+ }
}
return fbox->module_ctx.super.
More information about the dovecot-cvs
mailing list