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.
This commit is contained in:
Samuel Thibault 2020-07-07 22:09:29 +02:00
parent 91927b7c76
commit d63387d81d
1 changed files with 2 additions and 1 deletions

View 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) \
{ \