From bd6746732536fdf2ebaadff6f98aee0879b1674d Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 1 May 2011 22:59:14 -0400 Subject: 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. --- src/stdio/fclose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/stdio/fclose.c') 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); -- cgit v1.2.1