--- ansh/src/anshd.c 2011/10/14 09:04:04 1.1.1.1.2.5 +++ ansh/src/anshd.c 2011/10/14 12:03:10 1.1.1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: anshd.c,v 1.1.1.1.2.5 2011/10/14 09:04:04 misho Exp $ + * $Id: anshd.c,v 1.1.1.1.2.6 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 sched_root_task_t *root = NULL; +static struct tagProc *proc; + extern char compiled[], compiledby[], compilehost[]; static void @@ -79,6 +82,7 @@ static void sig(int s) { int state; + pid_t pid; switch (s) { case SIGHUP: @@ -93,7 +97,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, pktTx); break; } } @@ -119,8 +124,6 @@ main(int argc, char **argv) int fd, h = 0, uid = 0, gid = 0; char ch, szUser[STRSIZ] = "root", szChroot[STRSIZ] = "/", szDev[STRSIZ] = { 0 }; struct sigaction sact; - sched_root_task_t *root = NULL; - struct tagProc *proc; strlcpy(Key, DEFAULT_KEY, sizeof Key);