]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Don't crash if saving fails because of write error (out of disk space).
authorTimo Sirainen <tss@iki.fi>
Sun, 5 Oct 2008 15:43:48 +0000 (18:43 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 5 Oct 2008 15:43:48 +0000 (18:43 +0300)
--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-save.c

index b897651335de2e3ff347ad5c469011c62d8f967f..6d7dcfc93521fcddb75d029af8bbff604e6644a4 100644 (file)
@@ -790,7 +790,8 @@ void mbox_transaction_save_rollback(struct mbox_save_context *ctx)
                /* 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()");