# HG changeset patch # User Matt Johnston # Date 1171287150 0 # Node ID 5df05d0a536677888d31180355df3d7e218ecddd # Parent db976892c67fe3d43d3931b4cd21ffec391e535e Revert to default sigchld handler after forking, don't exit on error writing to the signal_pipe. diff -r db976892c67f -r 5df05d0a5366 svr-chansession.c --- a/svr-chansession.c Mon Feb 12 10:39:34 2007 +0000 +++ b/svr-chansession.c Mon Feb 12 13:32:30 2007 +0000 @@ -126,16 +126,12 @@ /* Make sure that the main select() loop wakes up */ while (1) { - /* EAGAIN means the pipe's full, so don't need to write anything */ - /* isserver is just a random byte to write */ - if (write(ses.signal_pipe[1], &ses.isserver, 1) == 1 - || errno == EAGAIN) { + /* isserver is just a random byte to write. We can't do anything + about an error so should just ignore it */ + if (write(ses.signal_pipe[1], &ses.isserver, 1) == 1 + || errno != EINTR) { break; } - if (errno == EINTR) { - continue; - } - dropbear_exit("error writing signal pipe"); } } @@ -662,6 +658,12 @@ if (!pid) { /* child */ + TRACE(("back to normal sigchld")) + /* Revert to normal sigchld handling */ + if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) { + dropbear_exit("signal() error"); + } + /* redirect stdin/stdout */ #define FDIN 0 #define FDOUT 1 @@ -759,6 +761,12 @@ if (pid == 0) { /* child */ + TRACE(("back to normal sigchld")) + /* Revert to normal sigchld handling */ + if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) { + dropbear_exit("signal() error"); + } + /* redirect stdin/stdout/stderr */ close(chansess->master);