aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-02 01:54:18 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-02 11:36:11 +0100
commite1a467d330d2dd4ab83adcadeba75961952ec826 (patch)
tree49df889516bc00b41edd2f58d1b2f98d1acda906
parentb7a5fec8b04edb505f51c207ae50b6777c2c55b2 (diff)
downloadglibc-e1a467d330d2dd4ab83adcadeba75961952ec826.zip
glibc-e1a467d330d2dd4ab83adcadeba75961952ec826.tar.gz
glibc-e1a467d330d2dd4ab83adcadeba75961952ec826.tar.bz2
hurd fcntl: Make LOCKED macro more robust
-rw-r--r--sysdeps/mach/hurd/fcntl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index ea35e9b..4860849 100644
--- a/sysdeps/mach/hurd/fcntl.c
+++ b/sysdeps/mach/hurd/fcntl.c
@@ -109,7 +109,7 @@ __libc_fcntl (int fd, int cmd, ...)
/* Set RESULT by evaluating EXPR with the descriptor locked.
Check for an empty descriptor and return EBADF. */
-#define LOCKED(expr) \
+#define LOCKED(expr) do { \
HURD_CRITICAL_BEGIN; \
__spin_lock (&d->port.lock); \
if (d->port.port == MACH_PORT_NULL) \
@@ -117,7 +117,8 @@ __libc_fcntl (int fd, int cmd, ...)
else \
result = (expr); \
__spin_unlock (&d->port.lock); \
- HURD_CRITICAL_END;
+ HURD_CRITICAL_END; \
+} while(0)
case F_GETFD: /* Get descriptor flags. */
LOCKED (d->flags);