From 38a254286953f5acdb13fdfcd50132aefafb1a75 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 22 Aug 2016 16:13:32 +0300 Subject: [PATCH] fs-metawrap: Added assert to make sure we don't create empty files. It seems like this could be happening in some situation. --- src/lib-fs/fs-metawrap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib-fs/fs-metawrap.c b/src/lib-fs/fs-metawrap.c index 9110c9202e..6c89383874 100644 --- a/src/lib-fs/fs-metawrap.c +++ b/src/lib-fs/fs-metawrap.c @@ -410,6 +410,9 @@ static int fs_metawrap_write_stream_finish(struct fs_file *_file, bool success) 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);