]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-show.c
cli/show: avoid empty write to stdout in format_part_raw
[notmuch] / notmuch-show.c
index c3a3783a4094c952f61b567907b87f658a1381ab..98b8535265f997c5c7651527a361ac2bbe92a6d5 100644 (file)
@@ -851,7 +851,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
                return NOTMUCH_STATUS_FILE_ERROR;
            }
 
                return NOTMUCH_STATUS_FILE_ERROR;
            }
 
-           if (fwrite (buf, size, 1, stdout) != 1) {
+           if (size > 0 && fwrite (buf, size, 1, stdout) != 1) {
                fprintf (stderr, "Error: Write failed\n");
                fclose (file);
                return NOTMUCH_STATUS_FILE_ERROR;
                fprintf (stderr, "Error: Write failed\n");
                fclose (file);
                return NOTMUCH_STATUS_FILE_ERROR;