aboutsummaryrefslogtreecommitdiffstats
path: root/common/ipc-client.c
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-22 11:27:36 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-22 11:27:39 +0100
commit1d010afbf72355eae0fdffa249f2588cb801c302 (patch)
tree27246e135aa3184f9e0a4cd7721e486097c4807d /common/ipc-client.c
parentMerge pull request #527 from gkbrk/swaylock_password_grow (diff)
downloadsway-1d010afbf72355eae0fdffa249f2588cb801c302.tar.gz
sway-1d010afbf72355eae0fdffa249f2588cb801c302.tar.zst
sway-1d010afbf72355eae0fdffa249f2588cb801c302.zip
Abort when receiving 0 bytes in IPC call
When sway crashes a swaybar process is sometimes left behind running at 100% CPU. This was caused by the swaybar trying to retrieve an IPC response from the closed sway socket. This patch fixes the problem by aborting when the socket has been closed (recv return 0). Fix #528
Diffstat (limited to 'common/ipc-client.c')
-rw-r--r--common/ipc-client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c
index 81348913..93f2963c 100644
--- a/common/ipc-client.c
+++ b/common/ipc-client.c
@@ -47,7 +47,7 @@ struct ipc_response *ipc_recv_response(int socketfd) {
47 size_t total = 0; 47 size_t total = 0;
48 while (total < ipc_header_size) { 48 while (total < ipc_header_size) {
49 ssize_t received = recv(socketfd, data + total, ipc_header_size - total, 0); 49 ssize_t received = recv(socketfd, data + total, ipc_header_size - total, 0);
50 if (received < 0) { 50 if (received <= 0) {
51 sway_abort("Unable to receive IPC response"); 51 sway_abort("Unable to receive IPC response");
52 } 52 }
53 total += received; 53 total += received;