about summary refs log tree commit diff
path: root/sysdeps/unix/closedir.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/closedir.c')
-rw-r--r--sysdeps/unix/closedir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c
index 791eaad250..1d4fd8eef0 100644
--- a/sysdeps/unix/closedir.c
+++ b/sysdeps/unix/closedir.c
@@ -37,9 +37,13 @@ DEFUN(closedir, (dirp), DIR *dirp)
       return -1;
     }
 
-  fd = dirp->fd;
+  __libc_lock_lock (dirp->lock);
 
+  fd = dirp->fd;
   free ((PTR) dirp->data);
+
+  __libc_lock_fini (dirp->lock);
+
   free ((PTR) dirp);
 
   return __close (fd);