fix false ownership of stdio FILEs due to tid reuse
[musl] / src / stdio / funlockfile.c
1 #include "stdio_impl.h"
2 #include "pthread_impl.h"
3
4 void __unlist_locked_file(FILE *);
5
6 void funlockfile(FILE *f)
7 {
8         if (f->lockcount == 1) {
9                 __unlist_locked_file(f);
10                 f->lockcount = 0;
11                 __unlockfile(f);
12         } else {
13                 f->lockcount--;
14         }
15 }