From: Timo Sirainen Date: Tue, 23 Aug 2011 01:52:55 +0000 (+0300) Subject: fts-lucene: Add '/' suffix to textcat_dir if it's not already there. X-Git-Tag: 2.1.alpha1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d28870ca63f2d92e315c43dced03b162afc5006;p=thirdparty%2Fdovecot%2Fcore.git fts-lucene: Add '/' suffix to textcat_dir if it's not already there. --- diff --git a/src/plugins/fts-lucene/lucene-wrapper.cc b/src/plugins/fts-lucene/lucene-wrapper.cc index f27b30404d..91719153af 100644 --- a/src/plugins/fts-lucene/lucene-wrapper.cc +++ b/src/plugins/fts-lucene/lucene-wrapper.cc @@ -94,12 +94,20 @@ struct lucene_index *lucene_index_init(const char *path, const char *textcat_conf) { struct lucene_index *index; + unsigned int len; index = i_new(struct lucene_index, 1); index->path = i_strdup(path); index->list = list; - index->textcat_dir = i_strdup(textcat_dir); - index->textcat_conf = i_strdup(textcat_conf); + if (textcat_dir != NULL) { + /* textcat really wants the '/' suffix */ + len = strlen(textcat_dir); + if (len > 0 && textcat_dir[len-1] != '/') + index->textcat_dir = i_strconcat(textcat_dir, "/", NULL); + else + index->textcat_dir = i_strdup(textcat_dir); + index->textcat_conf = i_strdup(textcat_conf); + } #ifdef HAVE_LUCENE_TEXTCAT index->default_analyzer = _CLNEW snowball::SnowballAnalyzer(DEFAULT_LANGUAGE); #else