diff options
Diffstat (limited to 'src/stdio/funlockfile.c')
-rw-r--r-- | src/stdio/funlockfile.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/stdio/funlockfile.c b/src/stdio/funlockfile.c index f8a2a071..30a07ef4 100644 --- a/src/stdio/funlockfile.c +++ b/src/stdio/funlockfile.c @@ -1,7 +1,15 @@ #include "stdio_impl.h" #include "pthread_impl.h" +void __unlist_locked_file(FILE *); + void funlockfile(FILE *f) { - if (!--f->lockcount) __unlockfile(f); + if (f->lockcount == 1) { + __unlist_locked_file(f); + f->lockcount = 0; + __unlockfile(f); + } else { + f->lockcount--; + } } |