From f174f655db4740d83598908ce2c355f65955045f Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sun, 19 Jan 2014 04:00:02 +0100 Subject: [PATCH] remove zombie proc_st when its state has been 'stolen' --- src/main-misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main-misc.c b/src/main-misc.c index 9c4141e8..6321bf22 100644 --- a/src/main-misc.c +++ b/src/main-misc.c @@ -286,7 +286,7 @@ void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k) list_del(&proc->list); s->active_clients--; - if (k && proc->pid != -1) + if (k && proc->pid != -1 && proc->pid != 0) kill(proc->pid, SIGTERM); remove_from_script_list(s, proc); @@ -686,7 +686,11 @@ int handle_commands(main_server_st * s, struct proc_st *proc) goto cleanup; } - break; + /* handle_auth_reinit() has succeeded so the current proc + * is in zombie state and unused. Terminate it. + */ + ret = ERR_WORKER_TERMINATED; + goto cleanup; case AUTH_REQ: if (proc->status != PS_AUTH_INIT) {