add proper fuxed-based locking for stdio
[musl] / src / stdio / fputc.c
index 98d0a20..6a144a5 100644 (file)
@@ -2,9 +2,10 @@
 
 int fputc(int c, FILE *f)
 {
-       FLOCK(f);
+       if (f->lock < 0 || !__lockfile(f))
+               return putc_unlocked(c, f);
        c = putc_unlocked(c, f);
-       FUNLOCK(f);
+       __unlockfile(f);
        return c;
 }