Cleanup: fix strict aliasing ion tests
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Sep 2011 17:44:40 +0000 (13:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Sep 2011 17:44:40 +0000 (13:44 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/ust-basic-tracing/ust-basic-tracing.c
tests/ust-multi-test/ust-multi-test.c

index a2f75d4e7c590acc1e13fcfffb6dddb141f3de88..583179c1e9b03354a20fe51fbe73179df4703840 100644 (file)
@@ -159,6 +159,11 @@ static int lttcomm_recv_fd(int sock)
        struct cmsghdr *cmsg;
        char recv_fd[CMSG_SPACE(sizeof(int))];
        struct msghdr msg = { 0 };
+       union {
+               unsigned char vc[4];
+               int vi;
+       } tmp;
+       int i;
 
        /* Prepare to receive the structures */
        iov[0].iov_base = &data_fd;
@@ -189,7 +194,9 @@ static int lttcomm_recv_fd(int sock)
                goto end;
        }
        /* this is our fd */
-       ret = ((int *) CMSG_DATA(cmsg))[0];
+       for (i = 0; i < sizeof(int); i++)
+               tmp.vc[i] = CMSG_DATA(cmsg)[0];
+       ret = tmp.vi;
        printf("received fd %d\n", ret);
 end:
        return ret;
index 2737c18fe15eb3dc01d66953a977a51d5dae1c5f..c4b4f212973958664d69592232542e9ec8470394 100644 (file)
@@ -167,6 +167,11 @@ static int lttcomm_recv_fd(int sock)
        struct cmsghdr *cmsg;
        char recv_fd[CMSG_SPACE(sizeof(int))];
        struct msghdr msg = { 0 };
+       union {
+               unsigned char vc[4];
+               int vi;
+       } tmp;
+       int i;
 
        /* Prepare to receive the structures */
        iov[0].iov_base = &data_fd;
@@ -197,7 +202,9 @@ static int lttcomm_recv_fd(int sock)
                goto end;
        }
        /* this is our fd */
-       ret = ((int *) CMSG_DATA(cmsg))[0];
+       for (i = 0; i < sizeof(int); i++)
+               tmp.vc[i] = CMSG_DATA(cmsg)[0];
+       ret = tmp.vi;
        printf("received fd %d\n", ret);
 end:
        return ret;
This page took 0.026795 seconds and 4 git commands to generate.