With my compile switches (which are mostly derived from RedHat spec file) I'm getting this warning: stream-test.c: In function 'sock_fd_read': stream-test.c:66:43: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *fd = *((int *) CMSG_DATA(cmsg)); ^ memcpy could decrease performance but as this is a test it's not an issue. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/tests/stream-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Changes from v1: - explain settings and warning in commit log. diff --git a/server/tests/stream-test.c b/server/tests/stream-test.c index 6317796..8fd1449 100644 --- a/server/tests/stream-test.c +++ b/server/tests/stream-test.c @@ -35,6 +35,7 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd) char control[CMSG_SPACE(sizeof (int))]; } cmsgu; struct cmsghdr *cmsg; + int i; iov.iov_base = buf; iov.iov_len = bufsize; @@ -63,7 +64,8 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd) exit(1); } - *fd = *((int *) CMSG_DATA(cmsg)); + memcpy(&i, CMSG_DATA(cmsg), sizeof(i)); + *fd = i; } else *fd = -1; } else { -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel