commit - d4632a727fbee65cb1585c6f6e9968d830f23a19
commit + 2d4ea288353c2240c8d13e41c8da1557fc32168b
blob - e64688ec22e1c280c395282b9b7a3ef8d3154650
blob + 295a559f6f14a551c6f66cb89b3036e620511db3
--- src/ngircd/resolve.c
+++ src/ngircd/resolve.c
#include "io.h"
+static void Init_Subprocess PARAMS(( void ));
static void Do_ResolveAddr PARAMS(( const ng_ipaddr_t *Addr, int Sock, int w_fd ));
static void Do_ResolveName PARAMS(( const char *Host, int w_fd ));
return true;
} else if( pid == 0 ) {
/* Sub process */
- Log_Init_Resolver();
+ Init_Subprocess();
Do_ResolveAddr( Addr, identsock, pipefd[1]);
Log_Exit_Resolver( );
exit(0);
return true;
} else if( pid == 0 ) {
/* Sub process */
- Log_Init_Resolver();
+ Init_Subprocess();
Do_ResolveName(Host, pipefd[1]);
Log_Exit_Resolver( );
exit(0);
}
return false;
} /* Resolve_Name */
+
+
+/**
+ * Signal handler for the forked resolver subprocess.
+ */
+static void
+Signal_Handler(int Signal)
+{
+ switch(Signal) {
+ case SIGTERM:
+#ifdef DEBUG
+ Log_Resolver(LOG_DEBUG, "Resolver: Got TERM signal, exiting.");
+#endif
+ exit(1);
+ }
+}
+/**
+ * Initialize forked resolver subprocess.
+ */
+static void
+Init_Subprocess(void)
+{
+ signal(SIGTERM, Signal_Handler);
+ Log_Init_Resolver();
+}
+
+
#if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO)
#if !defined(WANT_IPV6) && defined(h_errno)
static char *