summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-12-04 07:43:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-12-04 07:43:27 +0000
commitb1beaf3d04843307cc40f879927eaf88eab8d79c (patch)
treed348120efc6ede67c5f81f840244a21d29aa23e5 /usr.bin
parent1a4d4915bdab3bc431ce6d5237f1b27ae44939e9 (diff)
Do not write 16bit values directly to odd addresses - strict alignment
architectures don't like that. Makes cd blanking on sparc64 possible. OK deraadt@, krw@, jasper@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cdio/mmc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c
index 4482cafae7a..f2776b1fe27 100644
--- a/usr.bin/cdio/mmc.c
+++ b/usr.bin/cdio/mmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmc.c,v 1.26 2008/08/30 10:41:38 fgsch Exp $ */
+/* $OpenBSD: mmc.c,v 1.27 2009/12/04 07:43:26 claudio Exp $ */
/*
* Copyright (c) 2006 Michael Coulter <mjc@openbsd.org>
*
@@ -80,7 +80,7 @@ get_media_capabilities(int *cap, int rt)
scsireq_t scr;
u_char buf[4096];
u_int32_t i, dlen;
- u_int16_t feature;
+ u_int16_t feature, tmp;
u_int8_t feature_len;
int error;
@@ -90,7 +90,8 @@ get_media_capabilities(int *cap, int rt)
scr.cmd[0] = SCSI_GET_CONFIGURATION;
scr.cmd[1] = rt;
- *(u_int16_t *)(scr.cmd + 7) = htobe16(sizeof(buf));
+ tmp = htobe16(sizeof(buf));
+ memcpy(scr.cmd + 7, &tmp, sizeof(u_int16_t));
scr.flags = SCCMD_ESCAPE | SCCMD_READ;
scr.databuf = buf;