changeset 5403:c7a3410a8f1f HEAD

Crashfix
author Timo Sirainen <tss@iki.fi>
date Sun, 25 Mar 2007 19:26:09 +0300
parents 72c91dc78fad
children fd57e9c99846
files src/lib-storage/index/maildir/maildir-save.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-save.c	Sun Mar 25 19:21:09 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c	Sun Mar 25 19:26:09 2007 +0300
@@ -229,12 +229,20 @@
 		if (mail_set_seq(dest_mail, ctx->seq) < 0)
 			i_unreached();
 
-		tee = tee_i_stream_create(ctx->input, default_pool);
-		ctx->input = tee_i_stream_create_child(tee, default_pool);
-		ctx->input2 = tee_i_stream_create_child(tee, default_pool);
+		if (ctx->input == NULL) {
+			/* FIXME: copying with hardlinking. we could copy the
+			   cached data directly */
+			ctx->cur_dest_mail = 0;
+		} else {
+			tee = tee_i_stream_create(ctx->input, default_pool);
+			ctx->input =
+				tee_i_stream_create_child(tee, default_pool);
+			ctx->input2 =
+				tee_i_stream_create_child(tee, default_pool);
 
-		index_mail_cache_parse_init(dest_mail, ctx->input2);
-		ctx->cur_dest_mail = dest_mail;
+			index_mail_cache_parse_init(dest_mail, ctx->input2);
+			ctx->cur_dest_mail = dest_mail;
+		}
 	} else {
 		ctx->seq = 0;
 		ctx->cur_dest_mail = NULL;