From: Ralph Corderoy Date: Sun, 13 Aug 2017 17:07:33 +0000 (+0100) Subject: inc.c: Alter pop_action() to check I/O, perhaps returning NOTOK. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/6aec307fcced3dbd5dc47c52c79bd5c833021f51?ds=sidebyside;hp=bb0b14bdb72ac3b3fbee4ba4ff4da0b7848089bf inc.c: Alter pop_action() to check I/O, perhaps returning NOTOK. --- diff --git a/uip/inc.c b/uip/inc.c index 9a72aa45..20d4088b 100644 --- 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; }