]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #983 in SNORT/snort3 from stdlog to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Tue, 1 Aug 2017 21:30:55 +0000 (17:30 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Tue, 1 Aug 2017 21:30:55 +0000 (17:30 -0400)
Squashed commit of the following:

commit c8d172dc28a8157129d8426255d40fa4a3acd645
Author: Russ Combs <rucombs@cisco.com>
Date:   Tue Aug 1 08:52:05 2017 -0400

    stdlog: support snort 3> log for text alerts

src/log/text_log.cc

index 1604f4c8f46daba3dee4cfd16909f2091f101697..6ea36c9b7f408c0556dc17018ecae471ea1e001d 100644 (file)
@@ -41,6 +41,7 @@
 
 /* a reasonable minimum */
 #define MIN_BUF  (4* K_BYTES)
+#define STDLOG_FILENO 3
 
 struct TextLog
 {
@@ -65,7 +66,10 @@ struct TextLog
 static FILE* TextLog_Open(const char* name)
 {
     if ( name && !strcasecmp(name, "stdout") )
-        return stdout;
+    {
+        FILE* stdlog = fdopen(STDLOG_FILENO, "w");
+        return stdlog ? stdlog : stdout;
+    }
 
     return OpenAlertFile(name);
 }