]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricata: remove instance from ParseCommandLine
authorJason Ish <jason.ish@oisf.net>
Mon, 26 Feb 2024 21:55:04 +0000 (15:55 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 25 Mar 2024 16:36:28 +0000 (17:36 +0100)
We want to be able to call ParseCommandLine from library users, but
currently library users don't have access to the `suricata` instance
type. Since this var is used other places as a global, use the global
one in ParseCommandLine as well.

Not ideal, but isolating SCInstance to a non-global will be another
challenge on its own.

src/suricata.c

index fc88e7baf3cdda6664595c3e3bb552710b3bdff0..9d18fe6084d98da03c17cfe2667a423eb60f8693 100644 (file)
@@ -1312,8 +1312,9 @@ static bool IsLogDirectoryWritable(const char* str)
 
 extern int g_skip_prefilter;
 
-static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
+static TmEcode ParseCommandLine(int argc, char **argv)
 {
+    SCInstance *suri = &suricata;
     int opt;
 
     int dump_config = 0;
@@ -2899,7 +2900,7 @@ void SuricataPreInit(const char *progname)
 
 void SuricataInit(int argc, char **argv)
 {
-    if (ParseCommandLine(argc, argv, &suricata) != TM_ECODE_OK) {
+    if (ParseCommandLine(argc, argv) != TM_ECODE_OK) {
         exit(EXIT_FAILURE);
     }