diff --git a/clients/terminal.c b/clients/terminal.c index 38e40207..ec767641 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -23,6 +23,7 @@ #include "config.h" +#include #include #include #include @@ -3127,6 +3128,7 @@ int main(int argc, char *argv[]) struct display *d; struct terminal *terminal; const char *config_file; + struct sigaction sigpipe; struct weston_config *config; struct weston_config_section *s; @@ -3157,6 +3159,14 @@ int main(int argc, char *argv[]) return 1; } + /* Disable SIGPIPE so that paste operations do not crash the program + * when the file descriptor provided to receive data is a pipe or + * socket whose reading end has been closed */ + sigpipe.sa_handler = SIG_IGN; + sigemptyset(&sigpipe.sa_mask); + sigpipe.sa_flags = 0; + sigaction(SIGPIPE, &sigpipe, NULL); + d = display_create(&argc, argv); if (d == NULL) { fprintf(stderr, "failed to create display: %s\n",