]> git.sur5r.net Git - i3/i3/commitdiff
Fix unaligned memory access on sparc (Thanks David Coppa)
authorAxel Wagner <mail@merovius.de>
Tue, 3 May 2011 10:38:57 +0000 (12:38 +0200)
committerAxel Wagner <mail@merovius.de>
Tue, 3 May 2011 10:38:57 +0000 (12:38 +0200)
i3bar/src/ipc.c

index f943b4f0fc4fd6dfacdd2e5ebdcdcfcd6b32a075..2f5d481c70b43c1c4ac4aa817b71a89f65c4df69 100644 (file)
@@ -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 */