mirror of
https://github.com/NickHu/sway
synced 2024-12-26 21:58:30 +01:00
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
This commit is contained in:
parent
4ce1ab8a26
commit
1d010afbf7
1 changed files with 1 additions and 1 deletions
|
@ -47,7 +47,7 @@ struct ipc_response *ipc_recv_response(int socketfd) {
|
|||
size_t total = 0;
|
||||
while (total < ipc_header_size) {
|
||||
ssize_t received = recv(socketfd, data + total, ipc_header_size - total, 0);
|
||||
if (received < 0) {
|
||||
if (received <= 0) {
|
||||
sway_abort("Unable to receive IPC response");
|
||||
}
|
||||
total += received;
|
||||
|
|
Loading…
Reference in a new issue