Module: kamailio Branch: master Commit: 63d63cb86f9fa5dc0c3c51d4161d31cbd92832d4 URL: https://github.com/kamailio/kamailio/commit/63d63cb86f9fa5dc0c3c51d4161d31cbd92832d4
Author: Victor Seva <linuxman...@torreviejawireless.org> Committer: Victor Seva <linuxman...@torreviejawireless.org> Date: 2017-01-16T11:11:52+01:00 cdp: fix compiler warnings > receiver.c: In function 'send_fd': > receiver.c:287:2: warning: dereferencing type-punned pointer will break > strict-aliasing rules [-Wstrict-aliasing] > *(int*)CMSG_DATA(cmsg)=fd; > ^ > receiver.c: In function 'receive_fd': > receiver.c:385:3: warning: dereferencing type-punned pointer will break > strict-aliasing rules [-Wstrict-aliasing] > *fd=*((int*) CMSG_DATA(cmsg)); > ^ --- Modified: src/modules/cdp/receiver.c --- Diff: https://github.com/kamailio/kamailio/commit/63d63cb86f9fa5dc0c3c51d4161d31cbd92832d4.diff Patch: https://github.com/kamailio/kamailio/commit/63d63cb86f9fa5dc0c3c51d4161d31cbd92832d4.patch --- diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c index 10660d2..a572384 100644 --- a/src/modules/cdp/receiver.c +++ b/src/modules/cdp/receiver.c @@ -266,6 +266,7 @@ static int send_fd(int pipe_fd,int fd, peer *p) struct msghdr msg; struct iovec iov[1]; int ret; + int *tmp = NULL; #ifdef HAVE_MSGHDR_MSG_CONTROL struct cmsghdr* cmsg; @@ -284,7 +285,8 @@ static int send_fd(int pipe_fd,int fd, peer *p) cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); - *(int*)CMSG_DATA(cmsg)=fd; + tmp = (int*)CMSG_DATA(cmsg); + *tmp = fd; msg.msg_flags=0; #else msg.msg_accrights=(caddr_t) &fd; @@ -328,6 +330,7 @@ static int receive_fd(int pipe_fd, int* fd,peer **p) struct iovec iov[1]; int new_fd; int ret; + int *tmp = NULL; #ifdef HAVE_MSGHDR_MSG_CONTROL struct cmsghdr* cmsg; @@ -382,7 +385,8 @@ static int receive_fd(int pipe_fd, int* fd,peer **p) LM_ERR("receive_fd: msg level != SOL_SOCKET\n"); goto error; } - *fd=*((int*) CMSG_DATA(cmsg)); + tmp = (int*)CMSG_DATA(cmsg); + *fd = *tmp; }else{ if(!cmsg) LM_ERR("receive_fd: no descriptor passed, empty control message"); _______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev