/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hostpid.h"
#include "istream.h"
#include "istream-crlf.h"
#include "ostream.h"
#include "str.h"
#include "index-mail.h"
#include "cydir-storage.h"
#include "cydir-sync.h"
#include <stdio.h>
#include <utime.h>
struct cydir_save_context {
char *tmp_basename;
unsigned int mail_count;
/* updated for each appended mail: */
int fd;
};
static char *cydir_generate_tmp_filename(void)
{
static unsigned int create_count = 0;
return i_strdup_printf("temp.%s.P%sQ%uM%s.%s",
create_count++,
}
static const char *
{
const char *dir;
}
struct mail_save_context *
{
}
return t->save_ctx;
}
{
T_BEGIN {
const char *path;
} else {
path);
}
} T_END;
return -1;
/* add to index */
}
}
}
{
return -1;
return -1;
}
return 0;
}
{
int ret = 0;
ret = -1;
}
ret = -1;
}
}
else {
ret = -1;
}
} else {
ret = -1;
}
}
ret = -1;
}
return ret;
}
{
}
ctx->mail_count++;
else
}
{
(void)cydir_save_finish(_ctx);
}
{
const char *dir;
unsigned int n;
return -1;
}
"rename(%s, %s) failed: %m",
return -1;
}
}
return 0;
}
{
result);
}
{
}