pty: reset signal-handlers for childs

If signal-handlers are set to SIG_IGN, then this behavior is preserved
across an execve(). We don't want that so reset the handlers for all
childs before executing them.

kmscon may be executed with pre-set signal handlers for good reasons. So
reset the handlers in setup_child() so we have a clean environment.

This fixes a bug where child-programs assume SIGPIPE is not ignored but do
not explicitly set it to SIG_DFL.

Reported-by: Swift Geek [github issue #62]
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2013-01-13 15:58:40 +01:00
parent 5604a0a325
commit df2d153e39

View File

@ -269,7 +269,7 @@ static void setup_child(int master, struct winsize *ws)
sigset_t sigset;
pid_t pid;
char slave_name[128];
int slave = -1;
int slave = -1, i;
struct termios attr;
/* The child should not inherit our signal mask. */
@ -278,6 +278,9 @@ static void setup_child(int master, struct winsize *ws)
if (ret)
log_warn("cannot reset blocked signals: %m");
for (i = 1; i < SIGUNUSED; ++i)
signal(i, SIG_DFL);
ret = grantpt(master);
if (ret < 0) {
log_err("grantpt failed: %m");