]> diplodocus.org Git - nmh/commitdiff
inc.c: Alter pop_action() to check I/O, perhaps returning NOTOK.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 13 Aug 2017 17:07:33 +0000 (18:07 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 13 Aug 2017 17:07:33 +0000 (18:07 +0100)
uip/inc.c

index 9a72aa45f3a3cda66dedd2442d544b44e4215dfb..20d4088bce22c295e3f8058bd8b2cae447b5238f 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -918,7 +918,11 @@ static int
 pop_action(void *closure, char *s)
 {
     NMH_UNUSED(closure);
-    fprintf (pf, "%s\n", s);
-    stop += strlen (s) + 1;
+
+    if (fputs(s, pf) == EOF || putc('\n', pf) == EOF)
+        return NOTOK;
+
+    stop += strlen(s) + 1; /* Count linefeed too. */
+
     return OK;
 }