diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-04-07 07:55:35 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-04-07 07:55:35 -0400 |
commit | 50a31a6c88cf29d0ce43ded49ec5c10e6f59f4bf (patch) | |
tree | 369745f450eccd1b578fb60e42fa8d29daeff7c2 | |
parent | 270e01ce6db1fd9e42cc2f8466c8411f4a8be2c5 (diff) |
Fix dangling file descriptors (fixes #1152)
-rw-r--r-- | sway/ipc-server.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 0cacc515..3600cab2 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -161,7 +161,8 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) { } int flags; - if ((flags=fcntl(client_fd, F_GETFD)) == -1 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { + if ((flags = fcntl(client_fd, F_GETFD)) == -1 + || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { sway_log_errno(L_ERROR, "Unable to set CLOEXEC on IPC client socket"); close(client_fd); return 0; @@ -199,6 +200,8 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { } if (mask & WLC_EVENT_HANGUP) { + sway_log(L_DEBUG, "Client %d hung up", client->fd); + close(client->fd); client->fd = -1; ipc_client_disconnect(client); return 0; |