dovecot-2.1: maildir: When renaming filename due to broken size,...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 9 12:45:16 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/0a3eafad58c0
changeset: 13682:0a3eafad58c0
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 09 12:55:37 2011 +0200
description:
maildir: When renaming filename due to broken size, don't forget message flags.

diffstat:

 src/lib-storage/index/maildir/maildir-mail.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 12bd19be1315 -r 0a3eafad58c0 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Wed Nov 09 00:10:07 2011 +0200
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Wed Nov 09 12:55:37 2011 +0200
@@ -618,7 +618,7 @@
 {
 	struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
 	enum maildir_uidlist_rec_flag flags;
-	const char *subdir, *fname, *path, *newpath, *p;
+	const char *subdir, *fname, *path, *newpath, *p, *fname_info;
 	uoff_t size;
 	char wrong_key;
 
@@ -647,8 +647,12 @@
 		return;
 	}
 
-	newpath = t_strdup_printf("%s/%s/%s", mailbox_get_path(&mbox->box),
-				  subdir, t_strdup_until(fname, p));
+	fname_info = strchr(fname, MAILDIR_INFO_SEP);
+	if (fname_info == NULL)
+		fname_info = "";
+
+	newpath = t_strdup_printf("%s/%s/%s%s", mailbox_get_path(&mbox->box),
+				  subdir, t_strdup_until(fname, p), fname_info);
 	if (rename(path, newpath) == 0) {
 		mail_storage_set_critical(mail->box->storage,
 			"Maildir filename has wrong %c value, "


More information about the dovecot-cvs mailing list