/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "index-rebuild.h"
#include "mail-cache.h"
#include "sdbox-storage.h"
#include "sdbox-file.h"
#include "sdbox-sync.h"
#include <dirent.h>
{
/* if uidvalidity is set in the old index, use it */
if (uid_validity == 0)
}
static int
{
bool deleted;
int ret;
if (deleted)
return 0;
}
if (ret == 0) {
}
if (ret <= 0) {
if (ret < 0)
return -1;
return 0;
}
/* we were supposed to open the file in alt storage, but it
exists in primary storage as well. skip it to avoid adding
it twice. */
return 0;
}
T_BEGIN {
} T_END;
return 0;
}
static int
{
int ret;
strlen(SDBOX_MAIL_FILE_PREFIX)) != 0)
return 0;
i_warning("sdbox %s: Ignoring invalid filename %s",
return 0;
}
if (!primary)
return ret;
}
{
struct dirent *d;
int ret = 0;
if (!primary) {
/* alt directory doesn't exist, ignore */
return 0;
}
}
return -1;
}
do {
errno = 0;
break;
} while (ret >= 0);
if (errno != 0) {
ret = -1;
}
ret = -1;
}
return ret;
}
{
bool need_resize;
if (++hdr.rebuild_count == 0)
/* mailbox is being reset. this gets written directly there */
}
static int
{
int ret = 0;
&alt_path) < 0)
return -1;
ret = -1;
"sdbox: Rebuilding failed on alt path %s",
alt_path);
ret = -1;
}
}
return ret;
}
{
bool need_resize;
int ret;
hdr.rebuild_count != 0) {
/* already rebuilt by someone else */
return 0;
}
}
"sdbox: Alt storage not mounted, "
"aborting index rebuild");
return -1;
}
if (ret < 0)
else {
}
mbox->corrupted_rebuild_count = 0;
return ret;
}