URI: 
       tmore type-punned pointers - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 96898a81415df2368dfdbcf2b756982ba420a94f
   DIR parent 0c9c620f39e56c42802504003fd05664aba670a4
  HTML Author: Russ Cox <rsc@swtch.com>
       Date:   Wed, 10 Mar 2010 14:59:03 -0800
       
       more type-punned pointers
       
       R=rsc
       http://codereview.appspot.com/376045
       
       Diffstat:
         M src/lib9/sendfd.c                   |       2 +-
         M src/libip/udp.c                     |       4 ++--
       
       2 files changed, 3 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/src/lib9/sendfd.c b/src/lib9/sendfd.c
       t@@ -83,6 +83,6 @@ recvfd(int s)
                        return -1;
                }
                cmsg = CMSG_FIRSTHDR(&msg);
       -        fd = *(int*)CMSG_DATA(cmsg);
       +        memmove(&fd, CMSG_DATA(cmsg), sizeof(int));
                return fd;
        }
   DIR diff --git a/src/libip/udp.c b/src/libip/udp.c
       t@@ -46,8 +46,8 @@ udpwrite(int fd, Udphdr *hdr, void *buf, long n)
        
                memset(&sin, 0, sizeof sin);
                sin.sin_family = AF_INET;
       -        *(u32int*)&sin.sin_addr = *(u32int*)(hdr->raddr+12);
       -        *(u16int*)&sin.sin_port = *(u16int*)hdr->rport;
       +        memmove(&sin.sin_addr, hdr->raddr+12, 4);
       +        memmove(&sin.sin_port, hdr->rport, 2);
                return sendto(fd, buf, n, 0, (struct sockaddr*)&sin, sizeof sin);
        }