Mercurial > dovecot > core-2.2
changeset 13673:762b31157c42
maildir: Log less lines when removing broken sizes from filenames.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 08 Nov 2011 22:38:36 +0200 |
parents | 96e469ea4fc8 |
children | 439ba86c91fc |
files | src/lib-storage/index/maildir/maildir-mail.c |
diffstat | 1 files changed, 19 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-mail.c Tue Nov 08 21:50:46 2011 +0200 +++ b/src/lib-storage/index/maildir/maildir-mail.c Tue Nov 08 22:38:36 2011 +0200 @@ -620,6 +620,7 @@ enum maildir_uidlist_rec_flag flags; const char *subdir, *fname, *path, *newpath, *p; uoff_t size; + char wrong_key; if (maildir_sync_lookup(mbox, mail->uid, &flags, &fname) <= 0) return; @@ -633,27 +634,31 @@ path = t_strdup_printf("%s/%s/%s", mailbox_get_path(&mbox->box), subdir, fname); - if (maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE, - &size) && - field == MAIL_FETCH_VIRTUAL_SIZE) { - mail_storage_set_critical(mail->box->storage, - "Maildir filename has wrong W value: %s", path); - } - if (maildir_filename_get_size(fname, MAILDIR_EXTRA_FILE_SIZE, - &size) && - field == MAIL_FETCH_PHYSICAL_SIZE) { - mail_storage_set_critical(mail->box->storage, - "Maildir filename has wrong S value: %s", path); + if (field == MAIL_FETCH_VIRTUAL_SIZE && + maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE, + &size)) { + wrong_key = 'W'; + } else if (field == MAIL_FETCH_PHYSICAL_SIZE && + maildir_filename_get_size(fname, MAILDIR_EXTRA_FILE_SIZE, + &size)) { + wrong_key = 'S'; + } else { + /* the broken size isn't in filename */ + return; } newpath = t_strdup_printf("%s/%s/%s", mailbox_get_path(&mbox->box), subdir, t_strdup_until(fname, p)); if (rename(path, newpath) == 0) { - i_warning("Renamed broken maildir filename %s to %s", - path, newpath); + mail_storage_set_critical(mail->box->storage, + "Maildir filename has wrong %c value, " + "renamed the file from %s to %s", + wrong_key, path, newpath); } else { mail_storage_set_critical(mail->box->storage, - "rename(%s, %s) failed: %m", path, newpath); + "Maildir filename has wrong %c value, " + "but rename(%s, %s) failed: %m", + wrong_key, path, newpath); } }