[dovecot-cvs] dovecot: Don't crash if saving runs out of disk space while in t...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 12 16:59:49 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/90976e6d7e45
changeset: 5697:90976e6d7e45
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 12 16:59:42 2007 +0300
description:
Don't crash if saving runs out of disk space while in the middle of moving
multiple files to new/ or cur/ directories and the already moved files had
keywords.
diffstat:
1 file changed, 9 insertions(+)
src/lib-storage/index/maildir/maildir-save.c | 9 +++++++++
diffs (32 lines):
diff -r b929827ddbe9 -r 90976e6d7e45 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c Tue Jun 12 16:37:26 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c Tue Jun 12 16:59:42 2007 +0300
@@ -24,6 +24,7 @@ struct maildir_filename {
struct maildir_filename {
struct maildir_filename *next;
const char *basename;
+ const char *saved_dest_fname; /* only if it had keywords */
uoff_t size;
enum mail_flags flags;
@@ -276,12 +277,20 @@ maildir_get_updated_filename(struct mail
return FALSE;
}
+ /* If we're unlinking already copied files, ctx->sync_ctx could be
+ NULL by now. So we use the saved filename if it exists. */
+ if (mf->saved_dest_fname != NULL) {
+ *fname_r = mf->saved_dest_fname;
+ return FALSE;
+ }
+
buffer_update_const_data(ctx->keywords_buffer, mf + 1,
mf->keywords_count * sizeof(unsigned int));
*fname_r = maildir_filename_set_flags(
maildir_sync_get_keywords_sync_ctx(ctx->sync_ctx),
basename, mf->flags & MAIL_FLAGS_MASK,
&ctx->keywords_array);
+ mf->saved_dest_fname = p_strdup(ctx->pool, *fname_r);
return FALSE;
}
More information about the dovecot-cvs
mailing list