From: David Levine Date: Mon, 4 Aug 2014 02:05:03 +0000 (-0500) Subject: Here's a better fix to m_Eom() in m_getfld.c than commit X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/4f7866121132ca824df3fd6f847fc18f49cfd70b?ds=inline;hp=-c Here's a better fix to m_Eom() in m_getfld.c than commit d2520ac7054ad75d60342606bf13c821305d958c. The comparison of the return value of Getc() with EOF must be as an integer, not a char. --- 4f7866121132ca824df3fd6f847fc18f49cfd70b diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index c4bc15fd..7e92f9e3 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -788,8 +788,11 @@ m_unknown(m_getfld_state_t *gstate, FILE *iob) s->msg_style = MS_UNKNOWN; for (i = 0, cp = text; i < sizeof text; ++i, ++cp) { - if ((signed char) (*cp = Getc (s)) == EOF) { + if ((c = Getc (s)) == EOF) { + *cp = '\0'; break; + } else { + *cp = c; } } @@ -851,8 +854,13 @@ m_Eom (m_getfld_state_t s, int c) char *cp; for (i = 0, cp = text; i < s->edelimlen; ++i, ++cp) { - if ((signed char) (*cp = Getc (s)) == EOF) { + int c2; + + if ((c2 = Getc (s)) == EOF) { + *cp = '\0'; break; + } else { + *cp = c2; } }