fix dlsym RTLD_NEXT support
[oweals/musl.git] / src / stdio / fgetc.c
index 3a7f1e304850f46c5076577750126eb8fe20354d..65a10fa61777b164daab818595c53cf496e7194c 100644 (file)
@@ -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);