X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2Ffgetc.c;h=e122416406d8c8351b29b9bde71573dd355f894d;hp=3a7f1e304850f46c5076577750126eb8fe20354d;hb=HEAD;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/src/stdio/fgetc.c b/src/stdio/fgetc.c index 3a7f1e30..e1224164 100644 --- a/src/stdio/fgetc.c +++ b/src/stdio/fgetc.c @@ -3,8 +3,9 @@ int fgetc(FILE *f) { int c; - FLOCK(f); - c = f->rpos < f->rstop ? *f->rpos++ : __uflow(f); - FUNLOCK(f); + if (f->lock < 0 || !__lockfile(f)) + return getc_unlocked(f); + c = getc_unlocked(f); + __unlockfile(f); return c; }