The unified diff between revisions [cc1d98a9..] and [1d7826f7..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "svr-chansession.c"
# from [ca06b95b3ba61d4a526884a0c6bbedb65311c0f7]
# to [507d7fb29b5b0a8c412603048937d6cf61a54787]
#
============================================================
--- svr-chansession.c ca06b95b3ba61d4a526884a0c6bbedb65311c0f7
+++ svr-chansession.c 507d7fb29b5b0a8c412603048937d6cf61a54787
@@ -126,16 +126,12 @@ static void sesssigchild_handler(int UNU
/* 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 @@ static int noptycommand(struct Channel *
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 @@ static int ptycommand(struct Channel *ch
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);