提交 670d6d01 编写于 作者: R Rich Felker

fix unsynchronized access to FILE structure in fflush(0)

commit c002668e inadvertently moved
the check for unflushed write buffer outside of the scope of the
existing lock.
上级 511b7042
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册