Project

General

Profile

Bug #108 ยป 0001-fix-for-bug-108.patch

Anoop Saldanha, 04/16/2010 03:27 AM

View differences:

src/suricata.c
}
#endif
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
/* initialize the logging subsys */
SCLogInitLogModule(NULL);
......
}
SetBpfString(optind, argv);
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
UtilCpuPrintSummary();
#ifdef __SC_CUDA_SUPPORT__
src/util-debug.c
SCLogLevel log_level = SC_LOG_NOTSET;
const char *s = NULL;
if (sc_lid != NULL)
if (sc_lid != NULL) {
log_level = sc_lid->global_log_level;
else {
} else {
s = getenv(SC_LOG_ENV_LOG_LEVEL);
if (s != NULL)
log_level = SCMapEnumNameToValue(s, sc_log_level_map);
......
else {
sc_lc->log_level = SC_LOG_DEF_LOG_LEVEL;
#ifndef UNITTESTS
printf("Warning: Invalid global_log_level assigned by user. Falling "
"back on the default_log_level \"%s\"\n",
SCMapEnumValueToName(sc_lc->log_level, sc_log_level_map));
if (sc_lid != NULL) {
printf("Warning: Invalid/No global_log_level assigned by user. Falling "
"back on the default_log_level \"%s\"\n",
SCMapEnumValueToName(sc_lc->log_level, sc_log_level_map));
}
#endif
}
......
if (format == NULL || strlen(format) > SC_LOG_MAX_LOG_FORMAT_LEN) {
format = SC_LOG_DEF_LOG_FORMAT;
#ifndef UNITTESTS
printf("Warning: Invalid global_log_format supplied by user or format "
"length exceeded limit of \"%d\" characters. Falling back on "
"default log_format \"%s\"\n", SC_LOG_MAX_LOG_FORMAT_LEN,
format);
if (sc_lid != NULL) {
printf("Warning: Invalid/No global_log_format supplied by user or format "
"length exceeded limit of \"%d\" characters. Falling back on "
"default log_format \"%s\"\n", SC_LOG_MAX_LOG_FORMAT_LEN,
format);
}
#endif
}
if (format != NULL &&
(sc_lc->log_format = strdup(format)) == NULL) {
if (format != NULL && (sc_lc->log_format = strdup(format)) == NULL) {
printf("Error allocating memory\n");
exit(EXIT_FAILURE);
}
......
sc_lc->op_ifaces = sc_lid->op_ifaces;
sc_lid->op_ifaces = NULL;
sc_lc->op_ifaces_cnt = sc_lid->op_ifaces_cnt;
}
else {
} else {
s = getenv(SC_LOG_ENV_LOG_OP_IFACE);
if (s != NULL) {
op_iface = SCMapEnumNameToValue(s, sc_log_op_iface_map);
......
else {
op_iface = SC_LOG_DEF_LOG_OP_IFACE;
#ifndef UNITTESTS
printf("Warning: Output_interface not supplied by user. Falling "
"back on default_output_interface \"%s\"\n",
SCMapEnumValueToName(op_iface, sc_log_op_iface_map));
if (sc_lid != NULL) {
printf("Warning: Output_interface not supplied by user. Falling "
"back on default_output_interface \"%s\"\n",
SCMapEnumValueToName(op_iface, sc_log_op_iface_map));
}
#endif
}
......
}
/**
* \brief Initializes the logging module
* \brief Initializes the logging module.
*
* \param sc_did The initialization data for the logging module
* \param sc_lid The initialization data for the logging module. If sc_lid is
* NULL, we would stick to the default configuration for the
* logging subsystem.
*
*/
void SCLogInitLogModule(SCLogInitData *sc_lid)
    (1-1/1)