]> git.sur5r.net Git - i3/i3/blobdiff - libi3/ipc_recv_message.c
Merge pull request #2875 from botovq/next
[i3/i3] / libi3 / ipc_recv_message.c
index 8fd438e3455f2bf1456e1f52fdd18d442bd0aefb..16dda90d89b8cbcd5ec540aff00b1c3aba86d46c 100644 (file)
@@ -2,9 +2,11 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
+#include "libi3.h"
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -14,8 +16,6 @@
 
 #include <i3/ipc.h>
 
-#include "libi3.h"
-
 /*
  * Reads a message from the given socket file descriptor and stores its length
  * (reply_length) as well as a pointer to its contents (reply).
@@ -41,7 +41,6 @@ int ipc_recv_message(int sockfd, uint32_t *message_type,
         if (n == -1)
             return -1;
         if (n == 0) {
-            ELOG("IPC: received EOF instead of reply\n");
             return -2;
         }
 
@@ -54,10 +53,10 @@ int ipc_recv_message(int sockfd, uint32_t *message_type,
     }
 
     walk += strlen(I3_IPC_MAGIC);
-    *reply_length = *((uint32_t*)walk);
+    memcpy(reply_length, walk, sizeof(uint32_t));
     walk += sizeof(uint32_t);
     if (message_type != NULL)
-        *message_type = *((uint32_t*)walk);
+        memcpy(message_type, walk, sizeof(uint32_t));
 
     *reply = smalloc(*reply_length);