dovecot-1.1: mbox: Don't crash if saving fails because of write ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 5 18:43:55 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/3b0d23902a32
changeset: 7918:3b0d23902a32
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 05 18:42:27 2008 +0300
description:
mbox: Don't crash if saving fails because of write error (out of disk space).

diffstat:

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

diffs (22 lines):

diff -r a38daa8da7b3 -r 3b0d23902a32 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 05 17:20:48 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 05 18:42:27 2008 +0300
@@ -657,7 +657,7 @@ int mbox_save_finish(struct mail_save_co
 	if (ctx->output != NULL) {
 		/* make sure everything is written */
 		if (o_stream_flush(ctx->output) < 0)
-			return write_error(ctx);
+			write_error(ctx);
 	}
 
 	ctx->finished = TRUE;
@@ -782,7 +782,8 @@ void mbox_transaction_save_rollback(stru
 		/* failed, truncate file back to original size.
 		   output stream needs to be flushed before truncating
 		   so unref() won't write anything. */
-		o_stream_flush(ctx->output);
+		if (ctx->output != NULL)
+			o_stream_flush(ctx->output);
 
 		if (ftruncate(mbox->mbox_fd, (off_t)ctx->append_offset) < 0)
 			mbox_set_syscall_error(mbox, "ftruncate()");


More information about the dovecot-cvs mailing list