changeset 8244:327c893590c3 HEAD

mbox: Don't crash if saving fails because of write error (out of disk space).
author Timo Sirainen <tss@iki.fi>
date Sun, 05 Oct 2008 18:43:48 +0300
parents 9cabb706d3df
children 2b39142e6430
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 05 17:21:36 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 05 18:43:48 2008 +0300
@@ -790,7 +790,8 @@
 		/* 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()");