X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Ffgetc.c;h=65a10fa61777b164daab818595c53cf496e7194c;hb=708c91f4e9be2cfd6d35e71361956e13f3201b85;hp=3a7f1e304850f46c5076577750126eb8fe20354d;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/stdio/fgetc.c b/src/stdio/fgetc.c index 3a7f1e30..65a10fa6 100644 --- a/src/stdio/fgetc.c +++ b/src/stdio/fgetc.c @@ -3,8 +3,12 @@ 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; } + +weak_alias(fgetc, getc); +weak_alias(fgetc, _IO_getc);