about summary refs log tree commit diff
path: root/src/stdio/fclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fclose.c')
-rw-r--r--src/stdio/fclose.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c
index 317b3c90..839d88af 100644
--- a/src/stdio/fclose.c
+++ b/src/stdio/fclose.c
@@ -14,11 +14,11 @@ int fclose(FILE *f)
 	__unlist_locked_file(f);
 
 	if (!(perm = f->flags & F_PERM)) {
-		OFLLOCK();
+		FILE **head = __ofl_lock();
 		if (f->prev) f->prev->next = f->next;
 		if (f->next) f->next->prev = f->prev;
-		if (libc.ofl_head == f) libc.ofl_head = f->next;
-		OFLUNLOCK();
+		if (*head == f) *head = f->next;
+		__ofl_unlock();
 	}
 
 	r = fflush(f);