--- ansh/src/ansh3d.c 2011/10/14 09:04:04 1.1.1.1.2.3 +++ ansh/src/ansh3d.c 2011/10/14 12:03:10 1.1.1.1.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: ansh3d.c,v 1.1.1.1.2.3 2011/10/14 09:04:04 misho Exp $ + * $Id: ansh3d.c,v 1.1.1.1.2.4 2011/10/14 12:03:10 misho Exp $ * ************************************************************************* The ELWIX and AITNET software is distributed under the following @@ -55,6 +55,9 @@ proc_head_t pH; int bpfLEN, Timeout, Daemon = 1; char Key[STRSIZ]; +static struct tagProc *proc; +static sched_root_task_t *root; + extern char compiled[], compiledby[], compilehost[]; static void @@ -80,6 +83,7 @@ static void sig(int s) { int state; + pid_t pid; switch (s) { case SIGHUP: @@ -94,7 +98,8 @@ sig(int s) break; case SIGCHLD: VERB(1) LOG("Got SIGCHLD!\n"); - while (waitpid(-1, &state, WNOHANG) > 0); + while ((pid = waitpid(-1, &state, WNOHANG)) > 0) + stopProcess(root, &pH, pid, icmpTx); break; } } @@ -125,8 +130,6 @@ main(int argc, char **argv) long id = ANSH_ID; char ch, szUser[STRSIZ] = "root", szChroot[STRSIZ] = "/"; struct sigaction sact; - sched_root_task_t *root = NULL; - struct tagProc *proc; strlcpy(Key, DEFAULT_KEY, sizeof Key);