aboutsummaryrefslogtreecommitdiff
path: root/src/libip
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2010-03-10 14:50:33 -0800
committerRuss Cox <rsc@swtch.com>2010-03-10 14:50:33 -0800
commit0c9c620f39e56c42802504003fd05664aba670a4 (patch)
treead14a1a51f3b6193d0603725d62a34fbc4647c49 /src/libip
parent2fe14f1315eb8d3235ea8f978e5bd9444f467c2b (diff)
downloadplan9port-0c9c620f39e56c42802504003fd05664aba670a4.tar.gz
plan9port-0c9c620f39e56c42802504003fd05664aba670a4.tar.bz2
plan9port-0c9c620f39e56c42802504003fd05664aba670a4.zip
fix type-punned pointer warnings from gcc
R=rsc http://codereview.appspot.com/396042
Diffstat (limited to 'src/libip')
-rw-r--r--src/libip/udp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libip/udp.c b/src/libip/udp.c
index 042aa7e9..f318c4c3 100644
--- a/src/libip/udp.c
+++ b/src/libip/udp.c
@@ -21,8 +21,8 @@ udpread(int fd, Udphdr *hdr, void *buf, long n)
}
memset(hdr, 0, sizeof *hdr);
memmove(hdr->laddr, v4prefix, IPaddrlen);
- *(u32int*)(hdr->laddr+12) = *(u32int*)&sin.sin_addr;
- *(u16int*)hdr->lport = *(u16int*)&sin.sin_port;
+ memmove(hdr->laddr+12, &sin.sin_addr, sizeof(u32int));
+ memmove(hdr->lport, &sin.sin_port, sizeof(u16int));
len = sizeof sin;
n = recvfrom(fd, buf, n, 0, (struct sockaddr*)&sin, &len);
@@ -33,8 +33,8 @@ udpread(int fd, Udphdr *hdr, void *buf, long n)
return -1;
}
memmove(hdr->raddr, v4prefix, IPaddrlen);
- *(u32int*)(hdr->raddr+12) = *(u32int*)&sin.sin_addr;
- *(u16int*)hdr->rport = *(u16int*)&sin.sin_port;
+ memmove(hdr->raddr+12, &sin.sin_addr, sizeof(u32int));
+ memmove(hdr->rport, &sin.sin_port, sizeof(u16int));
return n;
}