mingw: fix compilation of signals code

pull/3112/head
Victor Julien 8 years ago
parent d8ddd3b5bc
commit e113fa96e9

@ -286,7 +286,7 @@ static void SignalHandlerSigterm(/*@unused@*/ int sig)
{
sigterm_count = 1;
}
#ifndef OS_WIN32
/**
* SIGUSR2 handler. Just set sigusr2_count. The main loop will act on
* it.
@ -305,6 +305,7 @@ static void SignalHandlerSigHup(/*@unused@*/ int sig)
{
sighup_count = 1;
}
#endif
#ifdef DBG_MEM_ALLOC
#ifndef _GLOBAL_MEM_
@ -2143,7 +2144,6 @@ static int WindowsInitService(int argc, char **argv)
return -1;
}
SCLogInfo("Current directory is set to: %s", path);
daemon = 1;
SCServiceInit(argc, argv);
}
@ -2196,14 +2196,12 @@ static int InitSignalHandler(SCInstance *suri)
{
/* registering signals we use */
UtilSignalHandlerSetup(SIGINT, SignalHandlerSigint);
UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2);
UtilSignalHandlerSetup(SIGTERM, SignalHandlerSigterm);
UtilSignalHandlerSetup(SIGPIPE, SIG_IGN);
UtilSignalHandlerSetup(SIGSYS, SIG_IGN);
#ifndef OS_WIN32
/* SIGHUP is not implemented on WIN32 */
UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2);
UtilSignalHandlerSetup(SIGHUP, SignalHandlerSigHup);
UtilSignalHandlerSetup(SIGPIPE, SIG_IGN);
UtilSignalHandlerSetup(SIGSYS, SIG_IGN);
/* Try to get user/group to run suricata as if
command line as not decide of that */
@ -2512,13 +2510,14 @@ static int ConfigGetCaptureValue(SCInstance *suri)
static void PostRunStartedDetectSetup(SCInstance *suri)
{
#ifndef OS_WIN32
/* registering signal handlers we use. We register usr2 here, so that one
* can't call it during the first sig load phase or while threads are still
* starting up. */
if (DetectEngineEnabled() && suri->sig_file == NULL &&
suri->delayed_detect == 0)
UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2);
#endif
if (suri->delayed_detect) {
/* force 'reload', this will load the rules and swap engines */
DetectEngineReload(suri);
@ -2848,7 +2847,7 @@ int main(int argc, char **argv)
#ifdef OS_WIN32
/* service initialization */
if (WindowsInit(argc, argv) != 0) {
if (WindowsInitService(argc, argv) != 0) {
exit(EXIT_FAILURE);
}
#endif /* OS_WIN32 */

@ -28,6 +28,7 @@
int UtilSignalBlock(int signum)
{
#ifndef OS_WIN32
sigset_t x;
if (sigemptyset(&x) < 0)
return -1;
@ -35,7 +36,7 @@ int UtilSignalBlock(int signum)
return -1;
if (sigprocmask(SIG_BLOCK, &x, NULL) < 0)
return -1;
#endif
return 0;
}
@ -57,6 +58,7 @@ void UtilSignalHandlerSetup(int sig, void (*handler)(int))
return;
}
#if 0
int UtilSignalIsHandler(int sig, void (*handler)(int))
{
struct sigaction action;
@ -66,3 +68,4 @@ int UtilSignalIsHandler(int sig, void (*handler)(int))
return (action.sa_handler == handler);
}
#endif

@ -26,6 +26,7 @@
int UtilSignalBlock(int);
void UtilSignalHandlerSetup(int, void (*handler)(int));
#if 0
int UtilSignalIsHandler(int sig, void (*handler)(int));
#endif
#endif /* __UTIL_SIGNAL_H__ */

Loading…
Cancel
Save