From 778268c9bbd176f976ee0ea4c137d1f90a8bd229 Mon Sep 17 00:00:00 2001 From: Axel Wagner Date: Tue, 3 May 2011 12:38:57 +0200 Subject: [PATCH] Fix unaligned memory access on sparc (Thanks David Coppa) --- i3bar/src/ipc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/i3bar/src/ipc.c b/i3bar/src/ipc.c index f943b4f0..2f5d481c 100644 --- a/i3bar/src/ipc.c +++ b/i3bar/src/ipc.c @@ -183,9 +183,11 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) { } char *walk = header + strlen(I3_IPC_MAGIC); - uint32_t size = *((uint32_t*) walk); + uint32_t size; + memcpy(&size, (uint32_t*)walk, sizeof(uint32_t)); walk += sizeof(uint32_t); - uint32_t type = *((uint32_t*) walk); + uint32_t type; + memcpy(&type, (uint32_t*)walk, sizeof(uint32_t)); /* Now that we know, what to expect, we can start read()ing the rest * of the message */