-/* $OpenBSD: uipc_usrreq.c,v 1.146 2021/05/17 17:06:51 claudio Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.147 2021/05/18 11:15:14 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
if ((error = unp_nam2sun(nam, &soun, &pathlen)))
return (error);
+ unp->unp_flags |= UNP_BINDING;
+
+ /*
+ * Enforce `i_lock' -> `unplock' because fifo subsystem
+ * requires it. The socket can't be closed concurrently
+ * because the file descriptor reference is still held.
+ */
+
+ sounlock(unp->unp_socket, SL_LOCKED);
+
nam2 = m_getclr(M_WAITOK, MT_SONAME);
nam2->m_len = sizeof(struct sockaddr_un);
memcpy(mtod(nam2, struct sockaddr_un *), soun,
soun->sun_path, p);
nd.ni_pledge = PLEDGE_UNIX;
- unp->unp_flags |= UNP_BINDING;
-
- /*
- * Enforce `i_lock' -> `unplock' because fifo subsystem
- * requires it. The socket can't be closed concurrently
- * because the file descriptor reference is still held.
- */
-
- sounlock(unp->unp_socket, SL_LOCKED);
-
KERNEL_LOCK();
/* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */
error = namei(&nd);