aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--notmuch-show.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index d14dac9..c674e25 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);