summaryrefslogtreecommitdiffhomepage
path: root/svr-chansession.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-08-18 16:42:08 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-08-18 16:42:08 +0000
commit4dd70c433e99c6a38d9547ef7c20b2aaccb75c6e (patch)
tree9cbeb5bdeee536919aa901bb9fd117041390d7c9 /svr-chansession.c
parentabf66aa7a1cb4d09a967b715ab7f59fc62801aaf (diff)
Mention the race condition between setting the childpid entry, and
the child exiting. --HG-- extra : convert_revision : 0acd2d97675d6a45fa1664790b4b9c891461de10
Diffstat (limited to 'svr-chansession.c')
-rw-r--r--svr-chansession.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/svr-chansession.c b/svr-chansession.c
index ffc50de..d56fb2c 100644
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -78,7 +78,6 @@ static void sesssigchild_handler(int dummy) {
TRACE(("enter sigchld handler"));
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
-
/* find the corresponding chansess */
for (i = 0; i < svr_ses.childpidsize; i++) {
if (svr_ses.childpids[i].pid == pid) {
@@ -630,7 +629,10 @@ static int noptycommand(struct Channel *channel, struct ChanSess *chansess) {
TRACE(("continue noptycommand: parent"));
chansess->pid = pid;
- /* add a child pid */
+ /* add a child pid - Beware: there's a race between this, and the
+ * exec() called from the child. If the child finishes before we've
+ * done this (ie if it was a shell builtin and fast), we won't return a
+ * proper return code. For now, we ignore this case. */
addchildpid(chansess, pid);
close(infds[FDIN]);