rewrite popen to use posix_spawn instead of fragile vfork hacks
[musl] / src / stdio / putc.c
index 3c9dc11..fa89349 100644 (file)
@@ -2,7 +2,11 @@
 
 int putc(int c, FILE *f)
 {
-       return fputc(c, f);
+       if (f->lock < 0 || !__lockfile(f))
+               return putc_unlocked(c, f);
+       c = putc_unlocked(c, f);
+       __unlockfile(f);
+       return c;
 }
 
 weak_alias(putc, _IO_putc);