Skip to content

Commit

Permalink
search_xapian: we need more than just an iamglass file
Browse files Browse the repository at this point in the history
  • Loading branch information
brong committed Sep 1, 2024
1 parent 9dba60b commit bc0f9bb
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions imap/search_xapian.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,31 +358,29 @@ static int xapstat(const char *path)
{
struct stat sbuf;
int r;

/* is there a glass file? */
char *glass = strconcat(path, "/iamglass", (char *)NULL);
r = stat(glass, &sbuf);
free(glass);

/* zero byte file is the same as no database */
if (!r && !sbuf.st_size) {
r = -1;
errno = ENOENT;
}
if (!r) return 0;

/* check for old chert file */
char *chert = strconcat(path, "/iamchert", (char *)NULL);
r = stat(chert, &sbuf);
free(chert);

/* zero byte file is the same as no database */
if (!r && !sbuf.st_size) {
r = -1;
errno = ENOENT;
int i;
const char *known_files[] = {
"cyrus.indexed.db",
"iamglass",
"position.glass",
"postlist.glass",
"termlist.glass",
NULL
};

for (i = 0; known_files[i]; i++) {
char *fname = strconcat(path, "/", known_files[i], (char *)NULL);
r = stat(fname, &sbuf);
free(fname);
/* zero byte file is the same as no database */
if (!r && !sbuf.st_size) {
r = -1;
errno = ENOENT;
}
if (r) return r;
}

return r;
return 0;
}

/* given an item from the activefile file, and the mboxname and partition
Expand Down

0 comments on commit bc0f9bb

Please sign in to comment.