projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
511b704
)
fix unsynchronized access to FILE structure in fflush(0)
author
Rich Felker
<dalias@aerifal.cx>
Tue, 29 Aug 2017 23:39:03 +0000
(19:39 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Tue, 29 Aug 2017 23:39:03 +0000
(19:39 -0400)
commit
c002668eb0352e619ea7064e4940b397b4a6e68d
inadvertently moved
the check for unflushed write buffer outside of the scope of the
existing lock.
src/stdio/fflush.c
patch
|
blob
|
history
diff --git
a/src/stdio/fflush.c
b/src/stdio/fflush.c
index c28810659aba7a6a6dd9148376314d251dc7bc69..bf1e843765761a4566ccb15130c94a0cc449a2c5 100644
(file)
--- a/
src/stdio/fflush.c
+++ b/
src/stdio/fflush.c
@@
-9,8
+9,11
@@
int fflush(FILE *f)
if (!f) {
int r = __stdout_used ? fflush(__stdout_used) : 0;
- for (f=*__ofl_lock(); f; f=f->next)
+ for (f=*__ofl_lock(); f; f=f->next) {
+ FLOCK(f);
if (f->wpos > f->wbase) r |= fflush(f);
+ FUNLOCK(f);
+ }
__ofl_unlock();
return r;