rework langinfo code for ABI compat and for use by time code
[musl] / src / stdio / fgetc.c
index 3a7f1e3..e122416 100644 (file)
@@ -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;
 }