int ret;
if ((ret = fts_indexer_more_int(ctx)) < 0) {
- mail_storage_set_internal_error(ctx->box->storage);
+ /* If failed is already set, the code has had a chance to
+ * set an internal error already, i.e. MAIL_ERROR_INUSE. */
+ if (!ctx->failed)
+ mail_storage_set_internal_error(ctx->box->storage);
ctx->failed = TRUE;
return -1;
}
}
if (fctx->indexing_timed_out)
ret = -1;
- if (!fctx->fts_lookup_success &&
- fctx->enforced != FTS_ENFORCED_NO) {
+ else if (!fctx->fts_lookup_success &&
+ fctx->enforced != FTS_ENFORCED_NO) {
/* FTS lookup failed and we didn't want to fallback to
opening all the mails and searching manually */
mail_storage_set_internal_error(ctx->transaction->box->storage);