mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] clipboard/wayland: ignore SIGPIPE from clients that hang up
Otherwise, a badly-behaving client causes Looking Glass to receive a SIGPIPE during Wayland copy operations. Handle EPIPE at call-sites instead. Co-authored-by: Quantum <quantum2048@gmail.com>
This commit is contained in:
parent
48941cb9c4
commit
2627381021
@ -410,6 +410,7 @@ static bool wayland_cb_init(
|
|||||||
this->dataFn = dataFn;
|
this->dataFn = dataFn;
|
||||||
this->display = wminfo->info.wl.display;
|
this->display = wminfo->info.wl.display;
|
||||||
this->registry = wl_display_get_registry(this->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.
|
// Wait for the initial set of globals to appear.
|
||||||
wl_registry_add_listener(this->registry, ®istry_listener, NULL);
|
wl_registry_add_listener(this->registry, ®istry_listener, NULL);
|
||||||
@ -451,6 +452,7 @@ static void data_source_handle_send(void * data, struct wl_data_source * source,
|
|||||||
ssize_t written = write(fd, transfer->data + pos, transfer->size - pos);
|
ssize_t written = write(fd, transfer->data + pos, transfer->size - pos);
|
||||||
if (written < 0)
|
if (written < 0)
|
||||||
{
|
{
|
||||||
|
if (errno != EPIPE)
|
||||||
DEBUG_ERROR("Failed to write clipboard data: %s", strerror(errno));
|
DEBUG_ERROR("Failed to write clipboard data: %s", strerror(errno));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -1861,6 +1861,12 @@ static int lg_run()
|
|||||||
signal(SIGINT , int_handler);
|
signal(SIGINT , int_handler);
|
||||||
signal(SIGTERM, 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
|
// try map the shared memory
|
||||||
if (!ivshmemOpen(&g_state.shm))
|
if (!ivshmemOpen(&g_state.shm))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user