summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/stdio/funlockfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/stdio/funlockfile.c')
-rw-r--r--libc-top-half/musl/src/stdio/funlockfile.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/stdio/funlockfile.c b/libc-top-half/musl/src/stdio/funlockfile.c
new file mode 100644
index 0000000..44d8b0d
--- /dev/null
+++ b/libc-top-half/musl/src/stdio/funlockfile.c
@@ -0,0 +1,13 @@
+#include "stdio_impl.h"
+#include "pthread_impl.h"
+
+void funlockfile(FILE *f)
+{
+ if (f->lockcount == 1) {
+ __unlist_locked_file(f);
+ f->lockcount = 0;
+ __unlockfile(f);
+ } else {
+ f->lockcount--;
+ }
+}