changeset: 79:5807f5aa47c0
tag: tip
user: Kris Maglione <maglione.k_AT_gmail.com>
date: Mon Jul 19 13:11:30 2010 -0400
files: lib9/_p9dialparse.c lib9/_p9dir.c lib9/sendfd.c lib9/truerand.c
description:
Sync lib9 with plan9port.
diff -r 84e25376f0a4 -r 5807f5aa47c0 lib9/_p9dialparse.c
--- a/lib9/_p9dialparse.c Mon Jul 19 11:50:26 2010 -0400
+++ b/lib9/_p9dialparse.c Mon Jul 19 13:11:30 2010 -0400
@@ -71,7 +71,7 @@
return -1;
break;
}
- *pip = *(u32int*)addr;
+ memmove(pip, addr, 4);
return 0;
}
diff -r 84e25376f0a4 -r 5807f5aa47c0 lib9/_p9dir.c
--- a/lib9/_p9dir.c Mon Jul 19 11:50:26 2010 -0400
+++ b/lib9/_p9dir.c Mon Jul 19 13:11:30 2010 -0400
@@ -44,6 +44,7 @@
#define _HAVESTGEN
#include <sys/disklabel.h>
#include <sys/ioctl.h>
+#include <sys/dkio.h>
static vlong
disksize(int fd, struct stat *st)
{
diff -r 84e25376f0a4 -r 5807f5aa47c0 lib9/sendfd.c
--- a/lib9/sendfd.c Mon Jul 19 11:50:26 2010 -0400
+++ b/lib9/sendfd.c Mon Jul 19 13:11:30 2010 -0400
@@ -46,7 +46,7 @@
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;
@@ -83,6 +83,6 @@
return -1;
}
cmsg = CMSG_FIRSTHDR(&msg);
- fd = *(int*)CMSG_DATA(cmsg);
+ memmove(&fd, CMSG_DATA(cmsg), sizeof(int));
return fd;
}
diff -r 84e25376f0a4 -r 5807f5aa47c0 lib9/truerand.c
--- a/lib9/truerand.c Mon Jul 19 11:50:26 2010 -0400
+++ b/lib9/truerand.c Mon Jul 19 13:11:30 2010 -0400
@@ -6,6 +6,7 @@
{
int i, n;
uchar buf[sizeof(ulong)];
+ ulong x;
static int randfd = -1;
static char *randfile;
@@ -21,5 +22,6 @@
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;
}
Received on Mon Jul 19 2010 - 19:11:37 CEST
This archive was generated by hypermail 2.2.0 : Mon Jul 19 2010 - 19:12:05 CEST