aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-05-10 13:00:01 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-10 15:57:23 -0700
commit802ca5a5efa5d11836b2ffd81c9f6fd42f938ac6 (patch)
tree76c6ff0b620ffd3354e30444a7a652082a8fa1e2 /sysdeps
parentecd0de9a955fd14e825a666ea6785842e1579326 (diff)
downloadglibc-802ca5a5efa5d11836b2ffd81c9f6fd42f938ac6.zip
glibc-802ca5a5efa5d11836b2ffd81c9f6fd42f938ac6.tar.gz
glibc-802ca5a5efa5d11836b2ffd81c9f6fd42f938ac6.tar.bz2
Hurd: Missing critical region locks.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/dirfd.c5
-rw-r--r--sysdeps/mach/hurd/opendir.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c
index 587ae7b..42dbc78 100644
--- a/sysdeps/mach/hurd/dirfd.c
+++ b/sysdeps/mach/hurd/dirfd.c
@@ -1,5 +1,5 @@
/* dirfd -- Return the file descriptor used by a DIR stream. Hurd version.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,8 @@ int
dirfd (DIR *dirp)
{
int fd;
+
+ HURD_CRITICAL_BEGIN;
__mutex_lock (&_hurd_dtable_lock);
for (fd = 0; fd < _hurd_dtablesize; ++fd)
if (_hurd_dtable[fd] == dirp->__fd)
@@ -35,6 +37,7 @@ dirfd (DIR *dirp)
fd = -1;
}
__mutex_unlock (&_hurd_dtable_lock);
+ HURD_CRITICAL_END;
return fd;
}
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index 217d4c8..c71cb18 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1993,1994,1995,1996,1997,1998,2001,2003,2005,2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1993-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -50,9 +49,11 @@ _hurd_fd_opendir (struct hurd_fd *d)
return NULL;
/* Set the descriptor to close on exec. */
+ HURD_CRITICAL_BEGIN;
__spin_lock (&d->port.lock);
d->flags |= FD_CLOEXEC;
__spin_unlock (&d->port.lock);
+ HURD_CRITICAL_END;
dirp->__fd = d;
dirp->__data = dirp->__ptr = NULL;