fix unsynchronized access to FILE structure in fflush(0)
commit c002668eb0 inadvertently moved
the check for unflushed write buffer outside of the scope of the
existing lock.
This commit is contained in:
1 parent
511b7042b3
commit
670d6d01f5
1 file changed
+4
-1
+4
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user