Mercurial > dovecot > core-2.2
changeset 9527:a1535b151afa HEAD
Maildir saving: If GUID is specified, try to preserve it in the filename.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 24 Jun 2009 16:42:15 -0400 |
parents | c8ff1a3722b7 |
children | d8556f68f6a7 |
files | src/lib-storage/index/maildir/maildir-save.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-save.c Wed Jun 24 14:20:11 2009 -0400 +++ b/src/lib-storage/index/maildir/maildir-save.c Wed Jun 24 16:42:15 2009 -0400 @@ -285,12 +285,12 @@ } static int maildir_create_tmp(struct maildir_mailbox *mbox, const char *dir, - const char **fname_r) + const char **fname) { struct mailbox *box = &mbox->ibox.box; struct stat st; unsigned int prefix_len; - const char *tmp_fname = NULL; + const char *tmp_fname = *fname; string_t *path; int fd; @@ -300,7 +300,8 @@ prefix_len = str_len(path); for (;;) { - tmp_fname = maildir_filename_generate(); + if (tmp_fname == NULL) + tmp_fname = maildir_filename_generate(); str_truncate(path, prefix_len); str_append(path, tmp_fname); @@ -325,9 +326,10 @@ /* race condition between stat() and open(). highly unlikely. */ } + tmp_fname = NULL; } - *fname_r = tmp_fname; + *fname = tmp_fname; if (fd == -1) { if (ENOSPACE(errno)) { mail_storage_set_error(box->storage, @@ -371,7 +373,7 @@ T_BEGIN { /* create a new file in tmp/ directory */ - const char *fname = NULL; + const char *fname = _ctx->guid; ctx->fd = maildir_create_tmp(ctx->mbox, ctx->tmpdir, &fname); if (ctx->fd == -1)