mirror of
https://github.com/fluencelabs/musl
synced 2025-06-27 05:32:06 +00:00
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.
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user