aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-07-11 17:12:53 +0200
committernyorain <nyorain@gmail.com>2017-07-11 17:12:53 +0200
commit20888fbb5e19e2bd7e45afb6fdbc2c1ed8cc769d (patch)
treea50906cc4549b44603687470aff889523db3047b
parent727215c90754a8c20d1a5b78d8c4194f885178b9 (diff)
Close fd in clipboard request
-rw-r--r--sway/ipc-server.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 937382af..829b8bf3 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -59,6 +59,7 @@ struct get_pixels_request {
struct get_clipboard_request {
struct ipc_client *client;
json_object *json;
+ int fd;
struct wlc_event_source *fd_event_source;
struct wlc_event_source *timer_event_source;
char *type;
@@ -354,6 +355,7 @@ static void release_clipboard_request(struct get_clipboard_request *req) {
free(req->buf);
wlc_event_source_remove(req->fd_event_source);
wlc_event_source_remove(req->timer_event_source);
+ close(req->fd);
free(req);
}
@@ -534,6 +536,7 @@ void ipc_get_clipboard(struct ipc_client *client, char *buf) {
req->pending = pending;
req->buf_position = 0;
req->buf_size = 512;
+ req->fd = pipes[0];
req->timer_event_source = wlc_event_loop_add_timer(ipc_selection_timer_cb, req);
req->fd_event_source = wlc_event_loop_add_fd(pipes[0],
WLC_EVENT_READABLE | WLC_EVENT_ERROR | WLC_EVENT_HANGUP,