Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jan 2011 23:46:36 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218148 - head/sbin/hastd
Message-ID:  <201101312346.p0VNkaFQ049917@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Jan 31 23:46:36 2011
New Revision: 218148
URL: http://svn.freebsd.org/changeset/base/218148

Log:
  Fix build on ia64.
  
  I found no way how to use CMSG_NXTHDR() macro on ia64 without alignment
  warnings.
  
  MFC after:	1 week

Modified:
  head/sbin/hastd/proto_common.c

Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c	Mon Jan 31 23:08:26 2011	(r218147)
+++ head/sbin/hastd/proto_common.c	Mon Jan 31 23:46:36 2011	(r218148)
@@ -113,7 +113,7 @@ proto_common_descriptor_send(int sock, i
 	cmsg->cmsg_level = SOL_SOCKET;
 	cmsg->cmsg_type = SCM_RIGHTS;
 	cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
-//	*((int *)CMSG_DATA(cmsg)) = fd;
+	bcopy(&fd, CMSG_DATA(cmsg), sizeof(fd));
 
 	if (sendmsg(sock, &msg, 0) == -1)
 		return (errno);
@@ -142,14 +142,12 @@ proto_common_descriptor_recv(int sock, i
 	if (recvmsg(sock, &msg, 0) == -1)
 		return (errno);
 
-	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
-	    cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-		if (cmsg->cmsg_level == SOL_SOCKET &&
-		    cmsg->cmsg_type == SCM_RIGHTS) {
-//			*fdp = *((int *)CMSG_DATA(cmsg));
-			return (0);
-		}
+	cmsg = CMSG_FIRSTHDR(&msg);
+	if (cmsg->cmsg_level != SOL_SOCKET ||
+	    cmsg->cmsg_type == SCM_RIGHTS) {
+		return (EINVAL);
 	}
+	bcopy(CMSG_DATA(cmsg), fdp, sizeof(*fdp));
 
-	return (ENOENT);
+	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101312346.p0VNkaFQ049917>