X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_csyslogd%2Fcsyslogd.c;fp=src%2Fos_csyslogd%2Fcsyslogd.c;h=2772b4ee113fdfb37424b950174ee5fa6182fc36;hp=696d3fe9b03cab2c461d3fe622358956505c3f62;hb=789cbc8e52da68eba3517b920ef22e000cf3c9fd;hpb=ef70704f0b31b59bb719b884d6a99cb9e3e2044a diff --git a/src/os_csyslogd/csyslogd.c b/src/os_csyslogd/csyslogd.c index 696d3fe..2772b4e 100755 --- a/src/os_csyslogd/csyslogd.c +++ b/src/os_csyslogd/csyslogd.c @@ -15,16 +15,12 @@ -/* strnlen is a GNU extension */ -#ifdef __linux__ - #define _GNU_SOURCE - #include -#endif +#include "shared.h" + #include "csyslogd.h" #include "os_net/os_net.h" - /* OS_SyslogD: Monitor the alerts and sends them via syslog. * Only return in case of error. */ @@ -56,7 +52,7 @@ void OS_CSyslogD(SyslogConfig **syslog_config) } sleep(1); } - merror("%s: INFO: File queue connected.", ARGV0 ); + debug1("%s: INFO: File queue connected.", ARGV0 ); /* Connecting to syslog. */ @@ -114,7 +110,7 @@ void OS_CSyslogD(SyslogConfig **syslog_config) int field_add_string(char *dest, int size, const char *format, const char *value ) { char buffer[OS_SIZE_2048]; int len = 0; - int dest_sz = size - strnlen(dest, OS_SIZE_2048); + int dest_sz = size - strlen(dest); if(dest_sz <= 0 ) { // Not enough room in the buffer @@ -139,13 +135,13 @@ int field_add_string(char *dest, int size, const char *format, const char *value int field_add_truncated(char *dest, int size, const char *format, const char *value, int fmt_size ) { char buffer[OS_SIZE_2048]; - int available_sz = size - strnlen(dest, OS_SIZE_2048); + int available_sz = size - strlen(dest); int total_sz = strlen(value) + strlen(format) - fmt_size; int field_sz = available_sz - strlen(format) + fmt_size; int len = 0; char trailer[] = "..."; - char *truncated; + char *truncated = NULL; if(available_sz <= 0 ) { // Not enough room in the buffer @@ -188,7 +184,7 @@ int field_add_truncated(char *dest, int size, const char *format, const char *va int field_add_int(char *dest, int size, const char *format, const int value ) { char buffer[255]; int len = 0; - int dest_sz = size - strnlen(dest, OS_SIZE_2048); + int dest_sz = size - strlen(dest); if(dest_sz <= 0 ) { // Not enough room in the buffer