X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Ffflush.c;h=3f462c80e8d12f6efbecd144a144d430736ec6eb;hb=062bb737de06c3906b4b4a07c7fc0fb286287efe;hp=715c1d10dbed3a310123ea7ea60efb2a9eda64c3;hpb=2499cd9d9be0ba74e16a6c3dd304e6d69070be35;p=musl diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c index 715c1d10..3f462c80 100644 --- a/src/stdio/fflush.c +++ b/src/stdio/fflush.c @@ -19,13 +19,12 @@ static int __fflush_unlocked(FILE *f) } /* stdout.c will override this if linked */ -static FILE *const dummy = 0; +static FILE *volatile dummy = 0; weak_alias(dummy, __stdout_used); int fflush(FILE *f) { int r; - FILE *next; if (f) { FLOCK(f); @@ -36,16 +35,12 @@ int fflush(FILE *f) r = __stdout_used ? fflush(__stdout_used) : 0; - OFLLOCK(); - for (f=libc.ofl_head; f; f=next) { + for (f=*__ofl_lock(); f; f=f->next) { FLOCK(f); - //OFLUNLOCK(); if (f->wpos > f->wbase) r |= __fflush_unlocked(f); - //OFLLOCK(); - next = f->next; FUNLOCK(f); } - OFLUNLOCK(); + __ofl_unlock(); return r; }