summaryrefslogtreecommitdiff
path: root/src/stdio/fclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fclose.c')
-rw-r--r--src/stdio/fclose.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c
index 8fdc3f7d..92bf7ff8 100644
--- a/src/stdio/fclose.c
+++ b/src/stdio/fclose.c
@@ -3,9 +3,12 @@
int fclose(FILE *f)
{
int r;
- int perm = f->flags & F_PERM;
+ int perm;
+
+ /* This lock is not paired with any unlock. */
+ FLOCK(f);
- if (!perm) {
+ if (!(perm = f->flags & F_PERM)) {
OFLLOCK();
if (f->prev) f->prev->next = f->next;
if (f->next) f->next->prev = f->prev;