Make IPC client socket non-blocking

This should prevent deadlocks with malicious clients
This commit is contained in:
Ilya Lukyanov 2017-08-04 16:05:05 +03:00
parent 8dec814bb4
commit de5bf64bfc
No known key found for this signature in database
GPG key ID: 382C32164F3D37D4

View file

@ -163,8 +163,8 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
int flags; int flags;
if ((flags = fcntl(client_fd, F_GETFD)) == -1 if ((flags = fcntl(client_fd, F_GETFD)) == -1
|| fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC|O_NONBLOCK) == -1) {
sway_log_errno(L_ERROR, "Unable to set CLOEXEC on IPC client socket"); sway_log_errno(L_ERROR, "Unable to set CLOEXEC|NONBLOCK on IPC client socket");
close(client_fd); close(client_fd);
return 0; return 0;
} }