Flush the writer before exec’ing

In the unlikely event the child process fails without exec’ing, we don’t
want both the child process and parent process to flush the OpusHead
header.

Thanks @omar-polo for reporting this!
This commit is contained in:
Frédéric Mangano 2020-10-31 18:36:56 +01:00
parent d071b6cabd
commit 57a4c0d5a0

View File

@ -382,9 +382,11 @@ static ot::status process(ot::ogg_reader& reader, ot::ogg_writer* writer, const
if ((rc = edit_tags(tags, opt)) != ot::st::ok)
return rc;
if (writer) {
if (opt.edit_interactively &&
(rc = edit_tags_interactively(tags, writer->path)) != ot::st::ok)
return rc;
if (opt.edit_interactively) {
fflush(writer->file); // flush before calling the subprocess
if ((rc = edit_tags_interactively(tags, writer->path)) != ot::st::ok)
return rc;
}
auto packet = ot::render_tags(tags);
rc = writer->write_header_packet(serialno, pageno, packet);
if (rc != ot::st::ok)