From: David Bremner Date: Sat, 4 May 2019 22:29:08 +0000 (-0300) Subject: cli/show: avoid empty write to stdout in format_part_raw X-Git-Tag: archive/debian/0.28.4-1~3 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=ae6b52488d71b879e2eb05d5ca6c4d4f641d0558;hp=ae6b52488d71b879e2eb05d5ca6c4d4f641d0558 cli/show: avoid empty write to stdout in format_part_raw Previously if the input was exactly a multiple of the internal buffer size, notmuch would attempt to fwrite nothing to stdout, but still expected fwrite to return 1, causing a failure that looked like this: $ notmuch show --format=raw id:87o96f1cya.fsf@codeaurora.org ...entire message shown as expected.. Error: Write failed $ echo $? 1 To fix the problem don't call fwrite at all when there's nothing to write. Amended by db: add some tests of message sizes likely to cause this problem. ---