fix type-punned pointer warnings from gcc
R=rsc http://codereview.appspot.com/396042
This commit is contained in:
parent
2fe14f1315
commit
0c9c620f39
11 changed files with 57 additions and 29 deletions
|
|
@ -71,7 +71,7 @@ parseip(char *host, u32int *pip)
|
|||
return -1;
|
||||
break;
|
||||
}
|
||||
*pip = *(u32int*)addr;
|
||||
memmove(pip, addr, 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ sendfd(int s, int fd)
|
|||
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
|
||||
cmsg->cmsg_level = SOL_SOCKET;
|
||||
cmsg->cmsg_type = SCM_RIGHTS;
|
||||
*(int*)CMSG_DATA(cmsg) = fd;
|
||||
memmove(CMSG_DATA(cmsg), &fd, sizeof(int));
|
||||
|
||||
if((n=sendmsg(s, &msg, 0)) != iov.iov_len)
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ truerand(void)
|
|||
{
|
||||
int i, n;
|
||||
uchar buf[sizeof(ulong)];
|
||||
ulong x;
|
||||
static int randfd = -1;
|
||||
static char *randfile;
|
||||
|
||||
|
|
@ -21,5 +22,6 @@ truerand(void)
|
|||
for(i=0; i<sizeof(buf); i += n)
|
||||
if((n = readn(randfd, buf+i, sizeof(buf)-i)) < 0)
|
||||
sysfatal("can't read %s: %r", randfile);
|
||||
return *((ulong*)buf);
|
||||
memmove(&x, buf, sizeof x);
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue