[hurd,commited,6/7] hurd fcntl: Make LOCKED macro more robust

Message ID 20230102100938.2778311-7-samuel.thibault@ens-lyon.org
State Committed, archived
Headers
Series hurd: fixes |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Samuel Thibault Jan. 2, 2023, 10:09 a.m. UTC
  ---
 sysdeps/mach/hurd/fcntl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index ea35e9b977..48608493a1 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);