From: Rich Felker Date: Mon, 2 May 2011 02:59:14 +0000 (-0400) Subject: fix undefined call order in fclose, possible lost output depending on compiler X-Git-Tag: v0.7.10~11 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bd6746732536fdf2ebaadff6f98aee0879b1674d;p=oweals%2Fmusl.git fix undefined call order in fclose, possible lost output depending on compiler pcc turned up this bug by calling f->close(f) before fflush(f), resulting in lost output and error on flush. --- diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index 26bc37e8..9481470d 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -13,7 +13,7 @@ int fclose(FILE *f) OFLUNLOCK(); } - r = fflush(f) | f->close(f); + r = -(fflush(f) || f->close(f)); if (!perm) free(f);