From 665ce267d994f7feb090c0c695c8462ae2d87a50 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 20 Mar 2022 13:19:12 +0100 Subject: check write errors on the output stream after each feed This will detect write errors sooner. --- sfeed_atom.c | 1 + sfeed_html.c | 1 + sfeed_mbox.c | 1 + sfeed_plain.c | 1 + sfeed_twtxt.c | 1 + 5 files changed, 5 insertions(+) diff --git a/sfeed_atom.c b/sfeed_atom.c index 07c34cd..3ce5cf0 100644 --- a/sfeed_atom.c +++ b/sfeed_atom.c @@ -150,6 +150,7 @@ main(int argc, char *argv[]) name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i]; printfeed(fp, name); checkfileerror(fp, argv[i], 'r'); + checkfileerror(stdout, "", 'w'); fclose(fp); } } diff --git a/sfeed_html.c b/sfeed_html.c index f3cff2b..ce96687 100644 --- a/sfeed_html.c +++ b/sfeed_html.c @@ -119,6 +119,7 @@ main(int argc, char *argv[]) err(1, "fopen: %s", argv[i]); printfeed(fp, &feeds[i - 1]); checkfileerror(fp, argv[i], 'r'); + checkfileerror(stdout, "", 'w'); fclose(fp); } } diff --git a/sfeed_mbox.c b/sfeed_mbox.c index 33c9ec6..30ac875 100644 --- a/sfeed_mbox.c +++ b/sfeed_mbox.c @@ -172,6 +172,7 @@ main(int argc, char *argv[]) name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i]; printfeed(fp, name); checkfileerror(fp, argv[i], 'r'); + checkfileerror(stdout, "", 'w'); fclose(fp); } } diff --git a/sfeed_plain.c b/sfeed_plain.c index c954eff..8b1f00f 100644 --- a/sfeed_plain.c +++ b/sfeed_plain.c @@ -78,6 +78,7 @@ main(int argc, char *argv[]) name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i]; printfeed(fp, name); checkfileerror(fp, argv[i], 'r'); + checkfileerror(stdout, "", 'w'); fclose(fp); } } diff --git a/sfeed_twtxt.c b/sfeed_twtxt.c index 8514bd6..1d8ab36 100644 --- a/sfeed_twtxt.c +++ b/sfeed_twtxt.c @@ -63,6 +63,7 @@ main(int argc, char *argv[]) name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i]; printfeed(fp, name); checkfileerror(fp, argv[i], 'r'); + checkfileerror(stdout, "", 'w'); fclose(fp); } } -- cgit v1.2.3