Skip to content

Instantly share code, notes, and snippets.

@ilyaluk
Created August 5, 2017 19:00
Show Gist options
  • Save ilyaluk/4cba205f94b71e5f62d412a615706c20 to your computer and use it in GitHub Desktop.
Save ilyaluk/4cba205f94b71e5f62d412a615706c20 to your computer and use it in GitHub Desktop.
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index dca881f..7db57ad 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -168,6 +168,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
close(client_fd);
return 0;
}
+ if ((flags = fcntl(client_fd, F_GETFL)) == -1
+ || fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) {
+ sway_log_errno(L_ERROR, "Unable to set NONBLOCK on IPC client socket");
+ close(client_fd);
+ return 0;
+ }
struct ipc_client* client = malloc(sizeof(struct ipc_client));
if (!client) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment