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/libauthsrv | |
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/libauthsrv')
-rw-r--r-- | src/libauthsrv/readnvram.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libauthsrv/readnvram.c b/src/libauthsrv/readnvram.c index 11e6950b..f65db984 100644 --- a/src/libauthsrv/readnvram.c +++ b/src/libauthsrv/readnvram.c @@ -76,8 +76,6 @@ readnvram(Nvrsafe *safep, int flag) if(strcmp(cputype, "386")==0 || strcmp(cputype, "alpha")==0) cputype = "pc"; - safe = (Nvrsafe*)buf; - fd = -1; safeoff = -1; safelen = -1; @@ -140,7 +138,7 @@ readnvram(Nvrsafe *safep, int flag) memset(safep, 0, sizeof(*safep)); safe = safep; }else{ - *safep = *safe; + memmove(safep, buf, sizeof *safep); safe = safep; err |= check(safe->machkey, DESKEYLEN, safe->machsum, "bad nvram key"); @@ -163,7 +161,7 @@ readnvram(Nvrsafe *safep, int flag) safe->configsum = nvcsum(safe->config, CONFIGLEN); safe->authidsum = nvcsum(safe->authid, sizeof(safe->authid)); safe->authdomsum = nvcsum(safe->authdom, sizeof(safe->authdom)); - *(Nvrsafe*)buf = *safe; + memmove(buf, safe, sizeof *safe); if(seek(fd, safeoff, 0) < 0 || write(fd, buf, safelen) != safelen){ fprint(2, "can't write key to nvram: %r\n"); |