mail-index-write.c revision aee5e9a405121be95b8e34f632d2e12797f92cc4
/* Copyright (C) 2003-2007 Timo Sirainen */
#include "lib.h"
#include "write-full.h"
#include "mail-index-private.h"
#include "mail-transaction-log-private.h"
#include <stdio.h>
{
unsigned int base_size;
const char *path;
if (fd == -1)
return -1;
/* write base header */
if (ret == 0) {
/* write extended headers */
}
if (ret == 0) {
}
if (ret < 0)
ret = -1;
}
ret = -1;
}
ret = -1;
}
if (ret < 0) {
path);
}
}
return ret;
}
{
unsigned int base_size;
if (MAIL_INDEX_IS_IN_MEMORY(index))
return 0;
/* write records. */
if (map->write_seq_first != 0) {
(map->write_seq_last -
return -1;
}
/* write base header. it has changed practically always, so
map->write_base_header might not be TRUE here in all situations.
It's used only to figure out if we want to write the map at all. */
return -1;
/* write extended headers */
if (map->write_ext_header) {
base_size) < 0)
return -1;
}
return 0;
}
#define mail_index_map_has_changed(map) \
(map)->write_seq_first != 0)
{
unsigned int lock_id;
if (!mail_index_map_has_changed(map))
return;
/* header size growed. we can't update this file anymore. */
}
/* index file doesn't exist, it's corrupted or we haven't
opened it for some reason */
}
if (!map->write_atomic) {
/* locking failed, rewrite */
}
}
if (map->write_atomic) {
if (!MAIL_INDEX_IS_IN_MEMORY(index)) {
if (mail_index_recreate(index) < 0) {
return;
}
}
} else {
if (mail_index_write_map_over(index) < 0) {
}
}
if (want_rotate &&
}