]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Ignore SIGPIPE
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 27 Apr 2023 08:04:55 +0000 (10:04 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 27 Apr 2023 17:21:24 +0000 (18:21 +0100)
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
src/server.c

index efc4e2f2ddf118b08a8932f8c216ac35161a35c2..b0c09c44c5ada6123259a00b40ddea64f65ff5af 100644 (file)
@@ -226,6 +226,16 @@ server_init(struct server *server)
                event_loop, SIGTERM, handle_sigterm, server->wl_display);
        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
         * output hardware. The autocreate option will choose the most suitable