Introduction
Introduction Statistics Contact Development Disclaimer Help
Sync lib9 with plan9port. - 9base - revived minimalist port of Plan 9 userland …
git clone git://git.suckless.org/9base
Log
Files
Refs
README
LICENSE
---
commit 38702511c5203e487776932e6ebdb1c0a9e80a67
parent 65f285bad8c2fe136ce4c4a99f12cfc1cb2d0f68
Author: Kris Maglione <[email protected]>
Date: Mon, 19 Jul 2010 13:11:30 -0400
Sync lib9 with plan9port.
Diffstat:
M lib9/_p9dialparse.c | 2 +-
M lib9/_p9dir.c | 1 +
M lib9/sendfd.c | 4 ++--
M lib9/truerand.c | 4 +++-
4 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/lib9/_p9dialparse.c b/lib9/_p9dialparse.c
@@ -71,7 +71,7 @@ parseip(char *host, u32int *pip)
return -1;
break;
}
- *pip = *(u32int*)addr;
+ memmove(pip, addr, 4);
return 0;
}
diff --git a/lib9/_p9dir.c b/lib9/_p9dir.c
@@ -44,6 +44,7 @@ disksize(int fd, struct stat *st)
#define _HAVESTGEN
#include <sys/disklabel.h>
#include <sys/ioctl.h>
+#include <sys/dkio.h>
static vlong
disksize(int fd, struct stat *st)
{
diff --git a/lib9/sendfd.c b/lib9/sendfd.c
@@ -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;
@@ -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;
}
diff --git a/lib9/truerand.c b/lib9/truerand.c
@@ -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;
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.