-/* strnlen is a GNU extension */
-#ifdef __linux__
- #define _GNU_SOURCE
- #include <string.h>
-#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.
*/
}
sleep(1);
}
- merror("%s: INFO: File queue connected.", ARGV0 );
+ debug1("%s: INFO: File queue connected.", ARGV0 );
/* Connecting to syslog. */
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
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
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