X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-show.c;h=c674e2506ff73270f4e43cd3937078ad3aa1b38b;hp=d14dac976e33d596565721fcd3616e8f12c814f4;hb=18947b95cd1668d1b98f7ea4196e97b050599f7d;hpb=fa73ffc614b9966bede3250fdfe6a3755d684f5a diff --git a/notmuch-show.c b/notmuch-show.c index d14dac97..c674e250 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -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);