aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-05 07:40:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-05 07:40:39 +0000
commit9cd22dc398ebe9fed80a4a4d48bee3467c2732ac (patch)
tree7319850011dce6a283c5fd2b75d0072aa72f83a3
parentselection: free strdup:ed clipboard data on fdm failure (diff)
selection: async send: handle POLLHUP
-rw-r--r--selection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/selection.c b/selection.c
index 2bb9b22a..72ade90b 100644
--- a/selection.c
+++ b/selection.c
@@ -328,8 +328,10 @@ struct clipboard_send {
static bool
fdm_send(struct fdm *fdm, int fd, int events, void *data)
{
- struct clipboard_send *ctx = data;
+ if (events & EPOLLHUP)
+ goto done;
+ struct clipboard_send *ctx = data;
switch (async_write(fd, ctx->data, ctx->len, &ctx->idx)) {
case ASYNC_WRITE_REMAIN:
@@ -345,6 +347,7 @@ fdm_send(struct fdm *fdm, int fd, int events, void *data)
break;
}
+done:
fdm_del(fdm, fd);
free(ctx->data);
free(ctx);