X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=notmuch-show.c;h=c674e2506ff73270f4e43cd3937078ad3aa1b38b;hb=18947b95cd1668d1b98f7ea4196e97b050599f7d;hp=87a1c906107742f772d6a7d9ae7ec75a054b0832;hpb=647c2509897e8a7cf12dba1a6ee81f8bb6e53b4d;p=notmuch diff --git a/notmuch-show.c b/notmuch-show.c index 87a1c906..c674e250 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -677,7 +677,7 @@ format_part_content_json (GMimeObject *part) if (g_mime_content_type_is_type (content_type, "text", "*")) { - /* For non-HTML text/* parts, we include the content in the + /* For non-HTML text parts, we include the content in the * JSON. Since JSON must be Unicode, we handle charset * decoding here and do not report a charset to the caller. * For text/html parts, we do not include the content. If a @@ -883,7 +883,17 @@ do_show_single (void *ctx, while (!feof (file)) { size = fread (buf, 1, sizeof (buf), file); - (void) fwrite (buf, size, 1, stdout); + if (ferror (file)) { + fprintf (stderr, "Error: Read failed from %s\n", filename); + fclose (file); + return 1; + } + + if (fwrite (buf, size, 1, stdout) != 1) { + fprintf (stderr, "Error: Write failed\n"); + fclose (file); + return 1; + } } fclose (file);