Fix unaligned memory access on sparc.

Patch already committed upstream
This commit is contained in:
dcoppa 2011-04-29 09:18:53 +00:00
parent 6554bf904f
commit ef75e7135c
4 changed files with 45 additions and 10 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.13 2011/04/07 08:58:10 dcoppa Exp $
# $OpenBSD: Makefile,v 1.14 2011/04/29 09:18:53 dcoppa Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-3.e-bf2
PKGNAME = i3-3.5.2
REVISION = 0
REVISION = 1
CATEGORIES = x11

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_ipc_c,v 1.1 2010/09/14 08:54:18 dcoppa Exp $
--- src/ipc.c.orig Wed Jun 9 09:58:15 2010
+++ src/ipc.c Thu Jul 15 14:43:03 2010
$OpenBSD: patch-src_ipc_c,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
--- src/ipc.c.orig Wed Jan 19 21:26:37 2011
+++ src/ipc.c Wed Apr 27 16:56:21 2011
@@ -91,7 +91,7 @@ static void ipc_send_message(int fd, const unsigned ch
char msg[buffer_size];
char *walk = msg;
@ -10,7 +10,27 @@ $OpenBSD: patch-src_ipc_c,v 1.1 2010/09/14 08:54:18 dcoppa Exp $
walk += strlen("i3-ipc");
memcpy(walk, &message_size, sizeof(uint32_t));
walk += sizeof(uint32_t);
@@ -502,20 +502,20 @@ void ipc_new_client(EV_P_ struct ev_io *w, int revents
@@ -437,7 +437,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w,
n -= strlen(I3_IPC_MAGIC);
/* The next 32 bit after the magic are the message size */
- uint32_t message_size = *((uint32_t*)message);
+ uint32_t message_size;
+ memcpy(&message_size, (uint32_t*)message, sizeof(uint32_t));
message += sizeof(uint32_t);
n -= sizeof(uint32_t);
@@ -447,7 +448,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w,
}
/* The last 32 bits of the header are the message type */
- uint32_t message_type = *((uint32_t*)message);
+ uint32_t message_type;
+ memcpy(&message_type, (uint32_t*)message, sizeof(uint32_t));
message += sizeof(uint32_t);
n -= sizeof(uint32_t);
@@ -502,20 +504,20 @@ void ipc_new_client(EV_P_ struct ev_io *w, int revents
int ipc_create_socket(const char *filename) {
int sockfd;
@ -36,7 +56,7 @@ $OpenBSD: patch-src_ipc_c,v 1.1 2010/09/14 08:54:18 dcoppa Exp $
return -1;
}
@@ -524,14 +524,14 @@ int ipc_create_socket(const char *filename) {
@@ -524,14 +526,14 @@ int ipc_create_socket(const char *filename) {
struct sockaddr_un addr;
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_LOCAL;

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/04/20 08:57:54 dcoppa Exp $
# $OpenBSD: Makefile,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
COMMENT = status and workspace bar for i3
DISTNAME = i3bar-0.6.21
REVISION = 0
CATEGORIES = x11
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_ipc_c,v 1.1.1.1 2011/04/20 08:57:54 dcoppa Exp $
$OpenBSD: patch-src_ipc_c,v 1.2 2011/04/29 09:18:53 dcoppa Exp $
--- src/ipc.c.orig Mon Apr 11 16:26:03 2011
+++ src/ipc.c Tue Apr 12 10:53:45 2011
+++ src/ipc.c Fri Apr 29 10:58:38 2011
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <unistd.h>
@ -9,3 +9,17 @@ $OpenBSD: patch-src_ipc_c,v 1.1.1.1 2011/04/20 08:57:54 dcoppa Exp $
#include <sys/socket.h>
#include <sys/un.h>
#include <i3/ipc.h>
@@ -160,9 +161,11 @@ void got_data(struct ev_loop *loop, ev_io *watcher, in
}
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 */