From db44740fd8c98795a53b4bdfce19743e9faecd04 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 26 Feb 2024 15:39:56 -0600 Subject: [PATCH] suricata: move WindowsInitService to SuricataMain Move WindowsInitService from SuricataInit() to SuricataMain(), as initializing Suricata as a service is very specific to the application and not something you'd want to happen in a library, and SuricataInit is more common initialization for application and library usage. --- src/suricata.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/suricata.c b/src/suricata.c index 62d8d0f623..fc88e7baf3 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -2899,13 +2899,6 @@ void SuricataPreInit(const char *progname) void SuricataInit(int argc, char **argv) { -#ifdef OS_WIN32 - /* service initialization */ - if (WindowsInitService(argc, argv) != 0) { - exit(EXIT_FAILURE); - } -#endif /* OS_WIN32 */ - if (ParseCommandLine(argc, argv, &suricata) != TM_ECODE_OK) { exit(EXIT_FAILURE); } @@ -3086,6 +3079,13 @@ int SuricataMain(int argc, char **argv) /* Pre-initialization tasks: initialize global context and variables. */ SuricataPreInit(argv[0]); +#ifdef OS_WIN32 + /* service initialization */ + if (WindowsInitService(argc, argv) != 0) { + exit(EXIT_FAILURE); + } +#endif /* OS_WIN32 */ + /* Initialization tasks: parse command line options, load yaml, start runmode... */ SuricataInit(argc, argv); -- 2.47.2