Mercurial > dovecot > original-hg > dovecot-2.1
changeset 14924:cfd3f39102bd
maildir: Preserve [SW]=sizes when renaming a maildir duplicate file.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 25 Feb 2013 16:44:57 +0200 |
parents | 10c1eb4ddef2 |
children | fa9387588430 |
files | src/lib-storage/index/maildir/maildir-sync.c |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync.c Sun Feb 24 15:52:57 2013 +0200 +++ b/src/lib-storage/index/maildir/maildir-sync.c Mon Feb 25 16:44:57 2013 +0200 @@ -288,6 +288,7 @@ const char *fname1, *path1, *path2; const char *new_fname, *new_path; struct stat st1, st2; + uoff_t size; fname1 = maildir_uidlist_sync_get_full_filename(ctx->uidlist_sync_ctx, fname2); @@ -330,6 +331,16 @@ } new_fname = maildir_filename_generate(); + /* preserve S= and W= sizes if they're available. + (S=size is required for zlib plugin to work) */ + if (maildir_filename_get_size(fname2, MAILDIR_EXTRA_FILE_SIZE, &size)) { + new_fname = t_strdup_printf("%s,%c=%"PRIuUOFF_T, + new_fname, MAILDIR_EXTRA_FILE_SIZE, size); + } + if (maildir_filename_get_size(fname2, MAILDIR_EXTRA_VIRTUAL_SIZE, &size)) { + new_fname = t_strdup_printf("%s,%c=%"PRIuUOFF_T, + new_fname, MAILDIR_EXTRA_VIRTUAL_SIZE, size); + } new_path = t_strconcat(mailbox_get_path(&ctx->mbox->box), "/new/", new_fname, NULL);