Reset SIGIPE handler before executing a command

This commit:

commit fb6d117c42
Author: Axel Wagner <mail@merovius.de>
Date:   Thu Dec 30 21:09:32 2010 +0100

    Port sighandler to tree-branch

blocks SIGPIPE. Unfortunatelly blocked signal set is preserved accross
execve()s, so any program executed by i3 inherited blocked SIGPIPE signal.
This leads to courious effects when pipe writer does not terminate after
exiting pipe reader.

Simple reproducer is to spawn a new xterm by a key shortcut and then run this
command there:

$ perl -e 'print $SIG{PIPE}, qq{\n}'
IGNORE

fixes #1237
This commit is contained in:
Petr Písař 2014-04-24 20:35:17 +02:00 committed by Michael Stapelberg
parent 7deb23c727
commit 2cc51841a5
1 changed files with 1 additions and 0 deletions

View File

@ -187,6 +187,7 @@ void start_application(const char *command, bool no_startup_id) {
} }
unsetenv("LISTEN_PID"); unsetenv("LISTEN_PID");
unsetenv("LISTEN_FDS"); unsetenv("LISTEN_FDS");
signal(SIGPIPE, SIG_DFL);
if (fork() == 0) { if (fork() == 0) {
/* Setup the environment variable(s) */ /* Setup the environment variable(s) */
if (!no_startup_id) if (!no_startup_id)