Restore zoulas fixes, stage 3.

This commit is contained in:
Arnold D. Robbins 2020-02-06 22:38:30 +02:00
parent cd552112a7
commit e6fe674b40

17
run.c
View File

@ -1850,23 +1850,24 @@ const char *filename(FILE *fp)
void closeall(void) void closeall(void)
{ {
int i, stat; size_t i;
bool stat = false;
for (i = 0; i < FOPEN_MAX; i++) { for (i = 0; i < nfiles; i++) {
if (files[i].fp) { if (! files[i].fp)
continue;
if (ferror(files[i].fp)) if (ferror(files[i].fp))
FATAL( "i/o error occurred on %s", files[i].fname ); FATAL( "i/o error occurred on %s", files[i].fname );
if (files[i].mode == '|' || files[i].mode == LE) if (files[i].mode == '|' || files[i].mode == LE)
stat = pclose(files[i].fp); stat = pclose(files[i].fp) == -1;
else else
stat = fclose(files[i].fp); stat = fclose(files[i].fp) == EOF;
if (stat == EOF) if (stat)
FATAL( "i/o error occurred while closing %s", files[i].fname ); FATAL( "i/o error occurred while closing %s", files[i].fname );
} }
} }
}
void flush_all(void) static void flush_all(void)
{ {
int i; int i;