Changeset 129e282


Ignore:
Timestamp:
2015-10-30T10:31:09Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
ad8a810
Parents:
0edc2fb
git-author:
dequis <dx@…> (27-10-15 05:43:57)
git-committer:
dequis <dx@…> (30-10-15 10:31:09)
Message:

ipc: Fix strict aliasing warnings

Turned out to be as simple as just using memcpy.

As with all strict aliasing warnings, these only appeared when
compiling with optimization, and might have caused Bad Things™

This page is cool:

http://dbp-consulting.com/tutorials/StrictAliasing.html

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    r0edc2fb r129e282  
    590590                                }
    591591
    592                                 *recv_fd = *(int *) CMSG_DATA(cmsg);
     592                                memcpy(recv_fd, CMSG_DATA(cmsg), sizeof(int));
    593593                                /*
    594594                                fprintf( stderr, "pid %d received fd %d\n", (int) getpid(), *recv_fd );
     
    758758        cmsg->cmsg_type = SCM_RIGHTS;
    759759        cmsg->cmsg_len = CMSG_LEN(sizeof(send_fd));
    760         *(int *) CMSG_DATA(cmsg) = send_fd;
     760        memcpy(CMSG_DATA(cmsg), &send_fd, sizeof(int));
    761761        msg.msg_controllen = cmsg->cmsg_len;
    762762#endif
Note: See TracChangeset for help on using the changeset viewer.