Ignore SIGPIPE

Prevent wayland clients that request the X11 clipboard but closing
their read fd prematurely to crash labwc because of the unhandled
SIGPIPE signal. It is caused by wlroots trying to write the X11
clipboard data to the closed fd of the wayland client.

See https://github.com/labwc/labwc/issues/890#issuecomment-1524962995
for a reproducer involving xclip and wl-paste | head -c 1.

Fixes #890
Reported-by: @FuzzyQuills
This commit is contained in:
Consolatis 2023-04-27 10:04:55 +02:00 committed by Johan Malm
parent 957dd43af2
commit ed8999456a

View file

@ -226,6 +226,16 @@ server_init(struct server *server)
event_loop, SIGTERM, handle_sigterm, server->wl_display); event_loop, SIGTERM, handle_sigterm, server->wl_display);
server->wl_event_loop = event_loop; server->wl_event_loop = event_loop;
/*
* Prevent wayland clients that request the X11 clipboard but closing
* their read fd prematurely to crash labwc because of the unhandled
* SIGPIPE signal. It is caused by wlroots trying to write the X11
* clipboard data to the closed fd of the wayland client.
* See https://github.com/labwc/labwc/issues/890#issuecomment-1524962995
* for a reproducer involving xclip and wl-paste | head -c 1.
*/
signal(SIGPIPE, SIG_IGN);
/* /*
* The backend is a feature which abstracts the underlying input and * The backend is a feature which abstracts the underlying input and
* output hardware. The autocreate option will choose the most suitable * output hardware. The autocreate option will choose the most suitable