diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-04 07:43:27 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-12-04 07:43:27 +0000 |
commit | b1beaf3d04843307cc40f879927eaf88eab8d79c (patch) | |
tree | d348120efc6ede67c5f81f840244a21d29aa23e5 | |
parent | 1a4d4915bdab3bc431ce6d5237f1b27ae44939e9 (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@
-rw-r--r-- | usr.bin/cdio/mmc.c | 7 |
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; |