Module: ngircd.git Branch: master Commit: 4cc4c29e380b24a0f53d99f702d6678f71a31ff3 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=4cc4c...
Author: Alexander Barton alex@barton.de Date: Thu Jul 1 00:39:35 2010 +0200
New function Proc_GenericSignalHandler()
---
src/ngircd/proc.c | 16 ++++++++++++++++ src/ngircd/proc.h | 2 ++ src/ngircd/resolve.c | 18 +----------------- 3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c index 5f3cade..75c1aaf 100644 --- a/src/ngircd/proc.c +++ b/src/ngircd/proc.c @@ -18,6 +18,7 @@ #include <errno.h> #include <signal.h> #include <string.h> +#include <stdlib.h> #include <unistd.h>
#include "log.h" @@ -99,4 +100,19 @@ Proc_Kill(PROC_STAT *proc) Proc_InitStruct(proc); }
+/** + * Generic signal handler for forked child processes. + */ +GLOBAL void +Proc_GenericSignalHandler(int Signal) +{ + switch(Signal) { + case SIGTERM: +#ifdef DEBUG + Log_Subprocess(LOG_DEBUG, "Child got TERM signal, exiting."); +#endif + exit(1); + } +} + /* -eof- */ diff --git a/src/ngircd/proc.h b/src/ngircd/proc.h index c342e1d..a7bff4f 100644 --- a/src/ngircd/proc.h +++ b/src/ngircd/proc.h @@ -30,6 +30,8 @@ GLOBAL pid_t Proc_Fork PARAMS((PROC_STAT *proc, int *pipefds,
GLOBAL void Proc_Kill PARAMS((PROC_STAT *proc));
+GLOBAL void Proc_GenericSignalHandler PARAMS((int Signal)); + #endif
/* -eof- */ diff --git a/src/ngircd/resolve.c b/src/ngircd/resolve.c index e5ac9ec..f8c39cf 100644 --- a/src/ngircd/resolve.c +++ b/src/ngircd/resolve.c @@ -109,28 +109,12 @@ Resolve_Name( PROC_STAT *s, const char *Host, void (*cbfunc)(int, short))
/** - * Signal handler for the forked resolver subprocess. - */ -static void -Signal_Handler(int Signal) -{ - switch(Signal) { - case SIGTERM: -#ifdef DEBUG - Log_Subprocess(LOG_DEBUG, "Resolver: Got TERM signal, exiting."); -#endif - exit(1); - } -} - - -/** * Initialize forked resolver subprocess. */ static void Init_Subprocess(void) { - signal(SIGTERM, Signal_Handler); + signal(SIGTERM, Proc_GenericSignalHandler); Log_Init_Subprocess("Resolver"); }
ngircd-commits@lists.barton.de