]> 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>
Fri, 9 Sep 2016 11:33:33 +0000 (14:33 +0300)
It seems like this could be happening in some situation.

src/lib-fs/fs-metawrap.c

index 9110c9202e5eb5c063032d134e0bc46048d3cff8..6c893838741604c34293396f83b855e30c9937a9 100644 (file)
@@ -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);