]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fs-metawrap: Added assert to make sure we don't create empty files.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 Aug 2016 13:13:32 +0000 (16:13 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 Aug 2016 13:13:32 +0000 (16:13 +0300)
It seems like this could be happening in some situation.

src/lib-fs/fs-metawrap.c

index 4b6519a2cb9976588ea2ea5a49961256fa01c708..4b5627737e4cb57916ce81cd314f8e6b9e3ed0f9 100644 (file)
@@ -395,6 +395,9 @@ static int fs_metawrap_write_stream_finish(struct fs_file *_file, bool success)
        }
        file->super_output = fs_write_stream(_file->parent);
        o_stream_nsend_istream(file->super_output, 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);
        return ret;