about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-07 22:09:29 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-07-07 22:10:24 +0200
commitd63387d81d575ba8187345d216070595bd58cb2b (patch)
tree3227e99c082ac5b24dbb1b3c889e7375870c376d
parent91927b7c76437db860cd86a7714476b56bb39d07 (diff)
downloadglibc-d63387d81d575ba8187345d216070595bd58cb2b.tar.gz
glibc-d63387d81d575ba8187345d216070595bd58cb2b.tar.xz
glibc-d63387d81d575ba8187345d216070595bd58cb2b.zip
hurd: Evaluate fd before entering the critical section
* sysdeps/hurd/include/hurd/fd.h (HURD_FD_PORT_USE_CANCEL): Evaluate fd
before calling _hurd_critical_section_lock.
-rw-r--r--sysdeps/hurd/include/hurd/fd.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/hurd/include/hurd/fd.h b/sysdeps/hurd/include/hurd/fd.h
index 3a6cdc7f36..1985b6fbb2 100644
--- a/sysdeps/hurd/include/hurd/fd.h
+++ b/sysdeps/hurd/include/hurd/fd.h
@@ -20,10 +20,11 @@ extern void _hurd_fd_port_use_cleanup (void *arg);
 /* Like HURD_FD_PORT_USE, but cleans fd on cancel.  */
 #define	HURD_FD_PORT_USE_CANCEL(fd, expr)				      \
   ({ error_t __result;							      \
-     void *__crit = _hurd_critical_section_lock ();			      \
      struct _hurd_fd_port_use_data __d;					      \
      io_t port, ctty;							      \
+     void *__crit;							      \
      __d.d = (fd);							      \
+     __crit = _hurd_critical_section_lock ();				      \
      __spin_lock (&__d.d->port.lock);					      \
      if (__d.d->port.port == MACH_PORT_NULL)				      \
        {								      \