fgetc-usage causing infinite-loop on linux-ppc

Philipp Schmidt philipp@ppc.in-berlin.de
Thu, 26 Sep 2002 20:09:47 +0200


The usage of fgetc, reading fgetc into an unsigned char causing an
infinite loop because eof iss too large for an unsigned char

the following patch solves the problem:

diff -r hugs98-Dec2001/src/input.c hugs98-Dec2001.fixed/src/input.c
515,516c515,517
<         lineBuffer[lineLength] = fgetc(inputStream);
<         if (lineBuffer[lineLength] == EOF)
---
>       int c = fgetc(inputStream);
>         lineBuffer[lineLength] = c;
>         if (c == EOF)

AVE!
  phils...

-- 
     PHILIPP SCHMIDT / phils - - + - - > philipp@ppc.in-berlin.de
     Phone: +49(179)6737439      ` - - > http://home.pages.de/~phils/
     wenn w eine   aube ist dn      man au dran dre en 
          o     Schr        an muss     hc         h   (Kurt Schwitters)
:wq