commit 4cc4c29e380b24a0f53d99f702d6678f71a31ff3 from: Alexander Barton date: Wed Jun 30 22:39:35 2010 UTC New function Proc_GenericSignalHandler() commit - 0db9a31e50598db6c01d67ea72e2970256e0558b commit + 4cc4c29e380b24a0f53d99f702d6678f71a31ff3 blob - 5f3cadeb5f7eef30ba99d249f62fe00d2f789abd blob + 75c1aaf1a0ba6dbfbb2f7abdfd8c91e01c76c8cf --- src/ngircd/proc.c +++ src/ngircd/proc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #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- */ blob - c342e1dfa568ab17c16eeb236d53a8e83ea15694 blob + a7bff4f39b79cd5b31e270d524d1f27a89190c5a --- src/ngircd/proc.h +++ src/ngircd/proc.h @@ -30,6 +30,8 @@ GLOBAL pid_t Proc_Fork PARAMS((PROC_STAT *proc, int *p GLOBAL void Proc_Kill PARAMS((PROC_STAT *proc)); +GLOBAL void Proc_GenericSignalHandler PARAMS((int Signal)); + #endif /* -eof- */ blob - e5ac9ec805dc6110c3b75ba9c451d7ae94bdfc94 blob + f8c39cf7160962c96e523f66143dee96d1931add --- src/ngircd/resolve.c +++ src/ngircd/resolve.c @@ -106,22 +106,6 @@ Resolve_Name( PROC_STAT *s, const char *Host, void (*c } return false; } /* Resolve_Name */ - - -/** - * 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); - } -} /** @@ -130,7 +114,7 @@ Signal_Handler(int Signal) static void Init_Subprocess(void) { - signal(SIGTERM, Signal_Handler); + signal(SIGTERM, Proc_GenericSignalHandler); Log_Init_Subprocess("Resolver"); }