]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
logging: change newline handling
authorVictor Julien <victor@inliniac.net>
Tue, 30 Jun 2015 07:09:17 +0000 (09:09 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 6 Jul 2015 13:52:47 +0000 (15:52 +0200)
src/util-debug.c

index 529e502a9177b53c6776cad9046f53ce42b809b8..17d6ee41f8ad89139a5356897aa406034447c25b 100644 (file)
@@ -156,7 +156,7 @@ static inline void SCLogPrintToStream(FILE *fd, char *msg)
        SCMutexLock(&sc_log_stream_lock);
 #endif /* OS_WIN32 */
 
-    if (fprintf(fd, "%s", msg) < 0)
+    if (fprintf(fd, "%s\n", msg) < 0)
         printf("Error writing to stream using fprintf\n");
 
     fflush(fd);
@@ -196,8 +196,6 @@ static inline void SCLogPrintToSyslog(int syslog_log_level, const char *msg)
  */
 static void SCLogOutputBuffer(SCLogLevel log_level, char *msg)
 {
-    char *temp = msg;
-    int len = strlen(msg);
     SCLogOPIfaceCtx *op_iface_ctx = NULL;
 
 #define MAX_SUBSTRINGS 30
@@ -209,15 +207,6 @@ static void SCLogOutputBuffer(SCLogLevel log_level, char *msg)
         return;
     }
 
-    /* We need to add a \n for our messages, before logging them.  If the
-     * messages have hit the 1023 length limit, strip the message to
-     * accomodate the \n */
-    if (len == SC_LOG_MAX_LOG_MSG_LEN - 1)
-        len = SC_LOG_MAX_LOG_MSG_LEN - 2;
-
-    temp[len] = '\n';
-    temp[len + 1] = '\0';
-
     if (sc_log_config->op_filter_regex != NULL) {
         if (pcre_exec(sc_log_config->op_filter_regex,
                       sc_log_config->op_filter_regex_study,