changeset 20236:783dd10f3dcf

lib-fs: Added fs_write_stream_abort_async()
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 01 Jun 2016 15:15:19 +0300
parents 2d4df68989ba
children 7f346855509b
files src/lib-fs/fs-api.c src/lib-fs/fs-api.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-fs/fs-api.c	Sat May 14 22:49:53 2016 +0200
+++ b/src/lib-fs/fs-api.c	Wed Jun 01 15:15:19 2016 +0300
@@ -692,6 +692,13 @@
 	(void)fs_write_stream_finish_int(file, FALSE);
 }
 
+void fs_write_stream_abort_async(struct fs_file *file)
+{
+	i_assert(file->output == NULL);
+
+	fs_write_stream_abort(file, &file->output);
+}
+
 void fs_write_set_hash(struct fs_file *file, const struct hash_method *method,
 		       const void *digest)
 {
--- a/src/lib-fs/fs-api.h	Sat May 14 22:49:53 2016 +0200
+++ b/src/lib-fs/fs-api.h	Wed Jun 01 15:15:19 2016 +0300
@@ -270,6 +270,9 @@
    o_stream_ignore_last_errors() is called on the output stream so the caller
    doesn't need to do it. */
 void fs_write_stream_abort(struct fs_file *file, struct ostream **output);
+/* Abort writing to a stream after fs_write_stream_finish() was already
+   called. */
+void fs_write_stream_abort_async(struct fs_file *file);
 
 /* Set a hash to the following write. The storage can then verify that the
    input data matches the specified hash, or fail if it doesn't. Typically