diff options
author | Russ Cox <rsc@swtch.com> | 2010-03-10 14:50:33 -0800 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2010-03-10 14:50:33 -0800 |
commit | 0c9c620f39e56c42802504003fd05664aba670a4 (patch) | |
tree | ad14a1a51f3b6193d0603725d62a34fbc4647c49 /src/cmd/vbackup | |
parent | 2fe14f1315eb8d3235ea8f978e5bd9444f467c2b (diff) | |
download | plan9port-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/cmd/vbackup')
-rw-r--r-- | src/cmd/vbackup/vnfs.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cmd/vbackup/vnfs.c b/src/cmd/vbackup/vnfs.c index cb9fdbf5..d4319c86 100644 --- a/src/cmd/vbackup/vnfs.c +++ b/src/cmd/vbackup/vnfs.c @@ -322,10 +322,14 @@ cryptinit(void) { uchar key[32], ivec[AESbsize]; int i; + u32int u32; - *(u32int*)sessid = truerand(); - for(i=0; i<nelem(key); i+=4) - *(u32int*)&key[i] = truerand(); + u32 = truerand(); + memmove(sessid, &u32, 4); + for(i=0; i<nelem(key); i+=4) { + u32 = truerand(); + memmove(key+i, &u32, 4); + } for(i=0; i<nelem(ivec); i++) ivec[i] = fastrand(); setupAESstate(&aesstate, key, sizeof key, ivec); @@ -793,6 +797,8 @@ cnodelookup(Ctree *t, Cnode **np, char *name) Nfs3Status cnodegetattr(Cnode *n, Nfs3Attr *attr) { + uint64 u64; + memset(attr, 0, sizeof *attr); if(n->read){ attr->type = Nfs3FileReg; @@ -805,7 +811,8 @@ cnodegetattr(Cnode *n, Nfs3Attr *attr) attr->size = 1024; attr->nlink = 10; } - attr->fileid = *(u64int*)n->handle; + memmove(&u64, n->handle, 8); + attr->fileid = u64; attr->atime.sec = n->mtime; attr->mtime.sec = n->mtime; attr->ctime.sec = n->mtime; @@ -817,6 +824,7 @@ cnodereaddir(Cnode *n, u32int count, u64int cookie, uchar **pdata, u32int *pcoun { uchar *data, *p, *ep, *np; u64int c; + u64int u64; Nfs3Entry ne; n = n->kidlist; @@ -842,7 +850,8 @@ cnodereaddir(Cnode *n, u32int count, u64int cookie, uchar **pdata, u32int *pcoun ne.name = n->name; ne.namelen = strlen(n->name); ne.cookie = ++cookie; - ne.fileid = *(u64int*)n->handle; + memmove(&u64, n->handle, 8); + ne.fileid = u64; if(nfs3entrypack(p, ep, &np, &ne) < 0) break; p = np; |