mail-index-write.c revision 0b2d4626c6fb4e40bc81c56d8227191f3c7e1ea3
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "read-full.h"
#include "write-full.h"
#include "ostream.h"
#include "mail-index-private.h"
#include "mail-transaction-log-private.h"
#include <stdio.h>
#define MAIL_INDEX_MIN_UPDATE_SIZE 1024
/* if we're updating >= count-n messages, recreate the index */
#define MAIL_INDEX_MAX_OVERWRITE_NEG_SEQ_COUNT 10
{
const char *backup_path, *tmp_backup_path;
int ret;
/* we very much want to avoid creating a backup file that
hasn't been written to disk yet */
return -1;
}
}
return -1;
}
}
if (ret < 0) {
/* no dovecot.index file, ignore */
return 0;
}
return -1;
}
return -1;
}
return 0;
}
{
unsigned int base_size;
const char *path;
if (fd == -1)
return -1;
if (o_stream_nfinish(output) < 0) {
ret = -1;
}
"fdatasync()");
ret = -1;
}
}
ret = -1;
}
(void)mail_index_create_backup(index);
ret = -1;
}
if (ret < 0) {
path);
}
}
return ret;
}
{
return;
if (!MAIL_INDEX_IS_IN_MEMORY(index)) {
if (mail_index_recreate(index) < 0) {
(void)mail_index_move_to_memory(index);
return;
}
}
if (want_rotate &&
}