changeset 20725:89984572c720

fs-metawrap: Added assert to make sure we don't create empty files. It seems like this could be happening in some situation.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 22 Aug 2016 16:13:32 +0300
parents f42da30440eb
children 231fad02c248
files src/lib-fs/fs-metawrap.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-fs/fs-metawrap.c	Fri Sep 09 02:48:45 2016 +0300
+++ b/src/lib-fs/fs-metawrap.c	Mon Aug 22 16:13:32 2016 +0300
@@ -410,6 +410,9 @@
 		ret = -1;
 	} else {
 		i_assert(i_stream_is_eof(input));
+		/* because of the "end of metadata" LF, there's always at least
+		   1 byte */
+		i_assert(file->super_output->offset > 0);
 		ret = fs_write_stream_finish(_file->parent, &file->super_output);
 	}
 	i_stream_unref(&input);