diff --git a/libutil/fshut.c b/libutil/fshut.c index f243a82..4de6596 100644 --- a/libutil/fshut.c +++ b/libutil/fshut.c @@ -7,10 +7,12 @@ int fshut(FILE *fp, const char *fname) { int ret = 0; - if (fflush(fp) && !ret) { - weprintf("fflush %s:", fname); - ret = 1; - } + /* fflush() is undefined for input streams by ISO C, + * but not POSIX 2008 if you ignore ISO C overrides. + * Leave it unchecked an rely on the following + * functions to detect errors. + */ + fflush(fp); if (ferror(fp) && !ret) { weprintf("ferror %s:", fname);