maildir-uidlist.c revision b37634f5bf23ff8c72b88ef6966fd5c730017419
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "str.h"
#include "write-full.h"
#include "mail-index.h"
#include "mail-index-util.h"
#include "maildir-index.h"
#include "maildir-uidlist.h"
#include <stdio.h>
#include <utime.h>
/* how many seconds to wait before overriding uidlist.lock */
{
const char *path;
int fd;
if (INDEX_IS_UIDLIST_LOCKED(index))
return 1;
if (fd == -1) {
return 0;
return -1;
}
return 1;
}
{
const char *path;
if (!INDEX_IS_UIDLIST_LOCKED(index))
return;
}
{
struct maildir_uidlist *uidlist;
unsigned int version;
int fd;
if (fd == -1) {
return NULL;
}
/* get header */
version != 1) {
/* broken file */
return NULL;
}
return uidlist;
}
struct maildir_uidlist_rec *uid_rec)
{
const char *line;
unsigned int uid;
return 0;
uid = 0;
line++;
}
/* invalid file */
return -1;
}
"UIDs not ordered in file %s (%u > %u)",
return -1;
}
"UID larger than next_uid in file %s "
return -1;
}
return 1;
}
{
}
{
struct mail_index_record *rec;
const char *p, *fname;
/* maildir should be synced, so above call should never fail */
/* flush buffer */
"write_full()");
return FALSE;
}
str_truncate(str, 0);
}
}
return FALSE;
}
/* uidlist's mtime must grow every time */
return FALSE;
}
return TRUE;
}
{
return FALSE;
}
if (!failed) {
FALSE) <= 0) {
"file_dotlock_replace(%s) failed: %m",
db_path);
}
} else {
}
if (failed)
return !failed;
}