X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Ffgetc.c;h=e122416406d8c8351b29b9bde71573dd355f894d;hb=1d92cddb1e1ed4b6cc0e55461727561e7a2522e0;hp=3a7f1e304850f46c5076577750126eb8fe20354d;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl 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; }