static int signalpipe[2];
+static const int signals_catch[] = {
+ SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
+};
+
#ifdef DEBUG
#endif
}
+
/**
* Reload the server configuration file.
*/
static void
-NGIRCd_Rehash( void )
+Rehash(void)
{
char old_name[CLIENT_ID_LEN];
unsigned old_nicklen;
Conn_SyncServerStruct( );
Log( LOG_NOTICE|LOG_snotice, "Re-reading of configuration done." );
-} /* NGIRCd_Rehash */
-
+} /* Rehash */
/**
/* shut down sever */
NGIRCd_SignalQuit = true;
return;
- case SIGHUP:
- break;
case SIGCHLD:
/* child-process exited, avoid zombies */
while (waitpid( -1, NULL, WNOHANG) > 0)
switch (Signal) {
case SIGHUP:
/* re-read configuration */
- NGIRCd_Rehash();
+ Rehash();
break;
#ifdef DEBUG
case SIGUSR2:
(void) what;
do {
- ret = read(fd, &sig, sizeof(sig));
+ ret = (int)read(fd, &sig, sizeof(sig));
if (ret == sizeof(int))
Signal_Handler_BH(sig);
} while (ret == sizeof(int));
}
-static const int signals_catch[] = { SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2 };
/**
* Initialize the signal handlers, catch
* those signals we are interested in and sets SIGPIPE to be ignored.
#ifdef HAVE_SIGACTION
struct sigaction saction;
#endif
+ if (signalpipe[0] > 0 || signalpipe[1] > 0)
+ return true;
if (pipe(signalpipe))
return false;
sigaction(SIGPIPE, &saction, NULL);
#else
for (i=0; i < C_ARRAY_SIZE(signals_catch) ; i++)
- sigaction(signals_catch[i], &saction, NULL);
+ signal(signals_catch[i], SIG_DFL);
signal(SIGPIPE, SIG_DFL);
#endif
close(signalpipe[1]);