dovecot-1.2: mbox: Don't crash if saving is aborted early.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 19 09:00:03 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/11727b49373e
changeset: 7899:11727b49373e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 19 08:13:36 2008 +0300
description:
mbox: Don't crash if saving is aborted early.

diffstat:

1 file changed, 5 insertions(+), 3 deletions(-)
src/lib-storage/index/mbox/mbox-save.c |    8 +++++---

diffs (18 lines):

diff -r 29d6c17f2009 -r 11727b49373e src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c	Wed Jun 18 12:09:48 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Thu Jun 19 08:13:36 2008 +0300
@@ -654,9 +654,11 @@ int mbox_save_finish(struct mail_save_co
 {
 	struct mbox_save_context *ctx = (struct mbox_save_context *)_ctx;
 
-	/* make sure everything is written */
-	if (o_stream_flush(ctx->output) < 0)
-		return write_error(ctx);
+	if (ctx->output != NULL) {
+		/* make sure everything is written */
+		if (o_stream_flush(ctx->output) < 0)
+			return write_error(ctx);
+	}
 
 	ctx->finished = TRUE;
 	if (!ctx->failed) {


More information about the dovecot-cvs mailing list