PERFORCE change 165262 for review

Gabor Pali pgj at FreeBSD.org
Fri Jun 26 17:35:54 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165262

Change 165262 by pgj at petymeg-current on 2009/06/26 17:35:05

	Fix passing of unix socket addresses

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/sys/kern/uipc_usrreq.c#4 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/sys/kern/uipc_usrreq.c#4 (text+ko) ====

@@ -1500,6 +1500,7 @@
 	struct unpcb *unp, **unp_list;
 	struct unp_head *head;
 	struct socket *sock;
+	struct sockaddr_un *sa;
 
 	error = 0;
 	head = ((intptr_t)arg1 == SOCK_DGRAM ? &unp_dhead : &unp_shead);
@@ -1569,10 +1570,11 @@
 			ud.ud_conn = (u_long)unp->unp_conn;
 			ud.ud_refs = (u_long)LIST_FIRST(&unp->unp_refs);
 			ud.ud_reflink = (u_long)LIST_NEXT(unp, unp_reflink);
-			ud.ud_address_len = (unp->unp_addr != NULL) ?
-			    unp->unp_addr->sun_len : 0;
-			if (ud.ud_address_len > 0) {
-				bcopy(ud.ud_address, unp->unp_addr,
+			if (unp->unp_addr != NULL) {
+				sa = unp->unp_addr;
+				ud.ud_address_len = sa->sun_len
+				    - offsetof(struct sockaddr_un, sun_path);
+				bcopy(sa->sun_path, ud.ud_address,
 				    ud.ud_address_len);
 			}
 			UNP_PCB_UNLOCK(unp);


More information about the p4-projects mailing list