summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2021-10-11 15:13:42 +0800
committerMatt Johnston <matt@ucc.asn.au>2021-10-11 15:13:42 +0800
commitcc59c08605a601f8b31baa92bd675b1c411bd53d (patch)
treed2f70a3441a1b235bebd2a81621802497ecabbb7
parent661d8ca225dd37916ed23b3d14ec96c979836d17 (diff)
downloaddropbear-cc59c08605a601f8b31baa92bd675b1c411bd53d.tar.gz
Move comment to svr_chansess_checksignal() where it belongs
-rw-r--r--svr-chansession.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/svr-chansession.c b/svr-chansession.c
index 65b8b26..6889fb0 100644
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -82,6 +82,14 @@ static int sesscheckclose(const struct Channel *channel) {
return chansess->exit.exitpid != -1;
}
+/* Handler for childs exiting, store the state for return to the client */
+
+/* There's a particular race we have to watch out for: if the forked child
+ * executes, exits, and this signal-handler is called, all before the parent
+ * gets to run, then the childpids[] array won't have the pid in it. Hence we
+ * use the svr_ses.lastexit struct to hold the exit, which is then compared by
+ * the parent when it runs. This work correctly at least in the case of a
+ * single shell spawned (ie the usual case) */
void svr_chansess_checksignal(void) {
int status;
pid_t pid;
@@ -127,18 +135,9 @@ void svr_chansess_checksignal(void) {
/* we use this to determine how pid exited */
ex->exitsignal = -1;
}
-
}
}
-/* Handler for childs exiting, store the state for return to the client */
-
-/* There's a particular race we have to watch out for: if the forked child
- * executes, exits, and this signal-handler is called, all before the parent
- * gets to run, then the childpids[] array won't have the pid in it. Hence we
- * use the svr_ses.lastexit struct to hold the exit, which is then compared by
- * the parent when it runs. This work correctly at least in the case of a
- * single shell spawned (ie the usual case) */
static void sesssigchild_handler(int UNUSED(dummy)) {
struct sigaction sa_chld;