about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2010-07-01 00:39:35 +0200
committerAlexander Barton <alex@barton.de>2010-07-01 00:39:35 +0200
commit4cc4c29e380b24a0f53d99f702d6678f71a31ff3 (patch)
treecdcc91a0342625c3ab556daa3d16ce1ec68c5e02 /src
parent0db9a31e50598db6c01d67ea72e2970256e0558b (diff)
downloadngircd-4cc4c29e380b24a0f53d99f702d6678f71a31ff3.tar.gz
ngircd-4cc4c29e380b24a0f53d99f702d6678f71a31ff3.zip
New function Proc_GenericSignalHandler()
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/proc.c16
-rw-r--r--src/ngircd/proc.h2
-rw-r--r--src/ngircd/resolve.c18
3 files changed, 19 insertions, 17 deletions
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c
index 5f3cadeb..75c1aaf1 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 c342e1df..a7bff4f3 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 e5ac9ec8..f8c39cf7 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");
 }