diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-05-01 22:59:14 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-05-01 22:59:14 -0400 |
commit | bd6746732536fdf2ebaadff6f98aee0879b1674d (patch) | |
tree | b9d9898f3ed515416bed535aa74180933818d31f /src/stdio/fclose.c | |
parent | a9be201cc0a2c04f430c029dd070fc0fbcd164b3 (diff) | |
download | musl-bd6746732536fdf2ebaadff6f98aee0879b1674d.tar.gz musl-bd6746732536fdf2ebaadff6f98aee0879b1674d.tar.xz musl-bd6746732536fdf2ebaadff6f98aee0879b1674d.zip |
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.
Diffstat (limited to 'src/stdio/fclose.c')
-rw-r--r-- | src/stdio/fclose.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |