Fix IPC messages writes with low buffer sizes
(upstream git commit f5b7bfb12ef74ddbf250e5076bbfaafd0027474c) This fixes a problem (reported by jasper@) where i3bar would exit due to malformed IPC messages when switching workspaces with some windows opened. OK jasper@
This commit is contained in:
parent
7fdd5b8f74
commit
f991dc42d6
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.55 2012/12/27 19:58:05 dcoppa Exp $
|
||||
# $OpenBSD: Makefile,v 1.56 2013/01/10 08:20:52 dcoppa Exp $
|
||||
|
||||
COMMENT = improved dynamic tiling window manager
|
||||
|
||||
DISTNAME = i3-4.4
|
||||
REVISION = 1
|
||||
REVISION = 2
|
||||
CATEGORIES = x11
|
||||
|
||||
EXTRACT_SUFX = .tar.bz2
|
||||
|
41
x11/i3/patches/patch-libi3_ipc_send_message_c
Normal file
41
x11/i3/patches/patch-libi3_ipc_send_message_c
Normal file
@ -0,0 +1,41 @@
|
||||
$OpenBSD: patch-libi3_ipc_send_message_c,v 1.1 2013/01/10 08:20:52 dcoppa Exp $
|
||||
|
||||
From f5b7bfb12ef74ddbf250e5076bbfaafd0027474c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Stapelberg <michael@stapelberg.de>
|
||||
Date: Wed, 09 Jan 2013 17:11:03 +0000
|
||||
Subject: Bugfix: fix IPC messages writes with low buffer sizes (Thanks jasper, dcoppa)
|
||||
|
||||
This fixes a problem where i3bar would exit due to malformed IPC
|
||||
messages when switching between workspaces with some windows opened.
|
||||
|
||||
--- libi3/ipc_send_message.c.orig Wed Dec 12 00:08:17 2012
|
||||
+++ libi3/ipc_send_message.c Thu Jan 10 09:07:13 2013
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <err.h>
|
||||
+#include <errno.h>
|
||||
|
||||
#include <i3/ipc.h>
|
||||
|
||||
@@ -38,14 +39,15 @@ int ipc_send_message(int sockfd, uint32_t message_size
|
||||
memcpy(walk, payload, message_size);
|
||||
|
||||
int sent_bytes = 0;
|
||||
- int bytes_to_go = buffer_size;
|
||||
- while (sent_bytes < bytes_to_go) {
|
||||
- int n = write(sockfd, msg + sent_bytes, bytes_to_go);
|
||||
- if (n == -1)
|
||||
+ while (sent_bytes < buffer_size) {
|
||||
+ int n = write(sockfd, msg + sent_bytes, buffer_size - sent_bytes);
|
||||
+ if (n == -1) {
|
||||
+ if (errno == EAGAIN)
|
||||
+ continue;
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
sent_bytes += n;
|
||||
- bytes_to_go -= n;
|
||||
}
|
||||
|
||||
return 0;
|
Loading…
Reference in New Issue
Block a user