]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Evaluate fd before entering the critical section
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 7 Jul 2020 20:09:29 +0000 (22:09 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 7 Jul 2020 20:10:24 +0000 (22:10 +0200)
* sysdeps/hurd/include/hurd/fd.h (HURD_FD_PORT_USE_CANCEL): Evaluate fd
before calling _hurd_critical_section_lock.

sysdeps/hurd/include/hurd/fd.h

index 3a6cdc7f360d4e1c8c981c4ae54ad24830e5845c..1985b6fbb266826e4418cb049975d3f1e993f0c0 100644 (file)
@@ -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)                                 \
        {                                                                     \