fix swprintf handling of nul character in output
[musl] / src / stdio / funlockfile.c
index d69f68e..44d8b0d 100644 (file)
@@ -3,5 +3,11 @@
 
 void funlockfile(FILE *f)
 {
-       FUNLOCK(f);
+       if (f->lockcount == 1) {
+               __unlist_locked_file(f);
+               f->lockcount = 0;
+               __unlockfile(f);
+       } else {
+               f->lockcount--;
+       }
 }