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:
parent
5604a0a325
commit
df2d153e39
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user