diff options
author | Will Estes <wlestes@users.sourceforge.net> | 2002-02-06 23:30:29 +0000 |
---|---|---|
committer | Will Estes <wlestes@users.sourceforge.net> | 2002-02-06 23:30:29 +0000 |
commit | 52fcba2f0b95c7175d88620f7978407fd623a745 (patch) | |
tree | 4599abc82751d5574ee438edfae265cfdfe390a7 /gen.c | |
parent | 27598b73c0a62a2132e71c7a61d61acb6619390e (diff) |
fix interrupted reads and freads; from the debian package maintainer
Diffstat (limited to 'gen.c')
-rw-r--r-- | gen.c | 30 |
1 files changed, 25 insertions, 5 deletions
@@ -1344,10 +1344,19 @@ void make_tables() { if ( use_read ) { + outn( "\terrno=0; \\" ); outn( -"\tif ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \\" ); +"\twhile ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \\" ); + outn( "\t{ \\" ); + outn( "\t\tif( errno != EINTR) \\" ); + outn( "\t\t{ \\" ); outn( - "\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" );" ); + "\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\" ); + outn( "\t\t\tbreak; \\" ); + outn( "\t\t} \\" ); + outn( "\t\terrno=0; \\" ); + outn( "\t\tclearerr(yyin); \\" ); + outn( "\t}" ); } else @@ -1367,11 +1376,22 @@ void make_tables() "\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\" ); outn( "\t\tresult = n; \\" ); outn( "\t\t} \\" ); + outn( "\telse \\" ); + outn( "\t\t{ \\" ); + outn( "\t\terrno=0; \\" ); outn( - "\telse if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\" ); - outn( "\t\t && ferror( yyin ) ) \\" ); +"\t\twhile ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\" ); + outn( "\t\t\t{ \\" ); + outn( "\t\t\tif( errno != EINTR) \\" ); + outn( "\t\t\t\t{ \\" ); outn( - "\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" );" ); + "\t\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\" ); + outn( "\t\t\t\tbreak; \\" ); + outn( "\t\t\t\t} \\" ); + outn( "\t\t\terrno=0; \\" ); + outn( "\t\t\tclearerr(yyin); \\" ); + outn( "\t\t\t} \\" ); + outn( "\t\t}" ); } } |