diff --git a/client/clipboards/Wayland/src/wayland.c b/client/clipboards/Wayland/src/wayland.c index 52a713af..3dded896 100644 --- a/client/clipboards/Wayland/src/wayland.c +++ b/client/clipboards/Wayland/src/wayland.c @@ -410,6 +410,7 @@ static bool wayland_cb_init( this->dataFn = dataFn; this->display = wminfo->info.wl.display; this->registry = wl_display_get_registry(this->display); + this->stashed_type = LG_CLIPBOARD_DATA_NONE; // Wait for the initial set of globals to appear. wl_registry_add_listener(this->registry, ®istry_listener, NULL); @@ -451,7 +452,8 @@ static void data_source_handle_send(void * data, struct wl_data_source * source, ssize_t written = write(fd, transfer->data + pos, transfer->size - pos); if (written < 0) { - DEBUG_ERROR("Failed to write clipboard data: %s", strerror(errno)); + if (errno != EPIPE) + DEBUG_ERROR("Failed to write clipboard data: %s", strerror(errno)); goto error; } diff --git a/client/src/main.c b/client/src/main.c index b85ce4dc..a93f6fc5 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1861,6 +1861,12 @@ static int lg_run() signal(SIGINT , int_handler); signal(SIGTERM, int_handler); + // Request to receive EPIPE instead of SIGPIPE when one end of a pipe + // disconnects while a write is pending. This is useful to the Wayland + // clipboard backend, where an arbitrary application is on the other end of + // that pipe. + signal(SIGPIPE, SIG_IGN); + // try map the shared memory if (!ivshmemOpen(&g_state.shm)) {