BIND 10 trac1452, updated. 3dfa82c4bae8bac305a4781eadc80ecfa6608534 [1452] made the code more strict-aliasing safe

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 21 22:17:17 UTC 2011


The branch, trac1452 has been updated
       via  3dfa82c4bae8bac305a4781eadc80ecfa6608534 (commit)
      from  f709af9e07ce8a0b700862fbc086e72c8f46f784 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3dfa82c4bae8bac305a4781eadc80ecfa6608534
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Dec 21 14:16:58 2011 -0800

    [1452] made the code more strict-aliasing safe

-----------------------------------------------------------------------

Summary of changes:
 src/lib/util/io/fd_share.cc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/util/io/fd_share.cc b/src/lib/util/io/fd_share.cc
index 563d249..b330b00 100644
--- a/src/lib/util/io/fd_share.cc
+++ b/src/lib/util/io/fd_share.cc
@@ -103,7 +103,7 @@ recv_fd(const int sock) {
     int fd = FD_OTHER_ERROR;
     if (cmsg != NULL && cmsg->cmsg_len == cmsg_len(sizeof(int)) &&
         cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
-        fd = *(const int*)CMSG_DATA(cmsg);
+        memcpy(&fd, CMSG_DATA(cmsg), sizeof(int));
     }
     free(msghdr.msg_control);
     return (fd);
@@ -132,7 +132,7 @@ send_fd(const int sock, const int fd) {
     cmsg->cmsg_len = cmsg_len(sizeof(int));
     cmsg->cmsg_level = SOL_SOCKET;
     cmsg->cmsg_type = SCM_RIGHTS;
-    *(int*)CMSG_DATA(cmsg) = fd;
+    memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
 
     const int ret = sendmsg(sock, &msghdr, 0);
     free(msghdr.msg_control);




More information about the bind10-changes mailing list