summaryrefslogtreecommitdiff
path: root/monitor/control.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-11-23 11:09:13 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-12-11 07:41:08 +0200
commitf4ececd75a1aeb3303ff88421a40699442a0edb2 (patch)
treee9ba5d25d55569d2e5b3053abf74b5949c0c1055 /monitor/control.c
parent28cf717c04ac33e5110f0c07dea28a920cf71fe3 (diff)
downloadbluez-f4ececd75a1aeb3303ff88421a40699442a0edb2.tar.gz
monitor: Fix build errors due to unaligned memory access
This fix following compilation errors on ARM. CC monitor/hcidump.o monitor/hcidump.c: In function ‘device_callback’: monitor/hcidump.c:147:11: error: cast increases required alignment of target type [-Werror=cast-align] monitor/hcidump.c:150:10: error: cast increases required alignment of target type [-Werror=cast-align] monitor/hcidump.c: In function ‘stack_internal_callback’: monitor/hcidump.c:348:9: error: cast increases required alignment of target type [-Werror=cast-align] cc1: all warnings being treated as errors make[1]: *** [monitor/hcidump.o] Error 1 CC monitor/control.o monitor/control.c: In function ‘data_callback’: monitor/control.c:584:10: error: cast increases required alignment of target type [-Werror=cast-align] cc1: all warnings being treated as errors make[1]: *** [monitor/control.o] Error 1
Diffstat (limited to 'monitor/control.c')
-rw-r--r--monitor/control.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/monitor/control.c b/monitor/control.c
index 3447b7a51..9b760388d 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -565,6 +565,7 @@ static void data_callback(int fd, uint32_t events, void *user_data)
while (1) {
struct cmsghdr *cmsg;
struct timeval *tv = NULL;
+ struct timeval ctv;
uint16_t opcode, index, pktlen;
ssize_t len;
@@ -580,8 +581,10 @@ static void data_callback(int fd, uint32_t events, void *user_data)
if (cmsg->cmsg_level != SOL_SOCKET)
continue;
- if (cmsg->cmsg_type == SCM_TIMESTAMP)
- tv = (struct timeval *) CMSG_DATA(cmsg);
+ if (cmsg->cmsg_type == SCM_TIMESTAMP) {
+ memcpy(&ctv, CMSG_DATA(cmsg), sizeof(ctv));
+ tv = &ctv;
+ }
}
opcode = btohs(hdr.opcode);