swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 1823ef9ab716ba09c00cc8e579b4920c5cef322c
parent bf8582de08b08cfb94dde974c8594390464ab3f6
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 23 Jan 2014 15:31:23 -0800

launch: Use memcpy instead of pointer aliasing

Diffstat:
Mlaunch/protocol.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/launch/protocol.c b/launch/protocol.c @@ -29,7 +29,7 @@ ssize_t send_fd(int socket, int fd, const void * buffer, ssize_t buffer_size) cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA(cmsg)) = fd; + memcpy(CMSG_DATA(cmsg), &fd, sizeof fd); } else { @@ -76,7 +76,7 @@ ssize_t receive_fd(int socket, int * fd, void * buffer, goto nofd; } - *fd = *((int *) CMSG_DATA(cmsg)); + memcpy(fd, CMSG_DATA(cmsg), sizeof *fd); } else {