Mercurial > dropbear
changeset 96:b8e36c1a5520
Mention the race condition between setting the childpid entry, and
the child exiting.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 18 Aug 2004 16:42:08 +0000 |
parents | b855bf63766c |
children | 27e633c92158 |
files | svr-chansession.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/svr-chansession.c Wed Aug 18 16:31:05 2004 +0000 +++ b/svr-chansession.c Wed Aug 18 16:42:08 2004 +0000 @@ -78,7 +78,6 @@ 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 @@ 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]);