Project

General

Profile

Bug #15 » 0002-check-for-the-existance-of-default-logging-directory.patch

check for the existance of the default log dir - Anoop Saldanha, 01/03/2010 11:47 PM

View differences:

src/suricata-common.h
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <netinet/in.h>
src/suricata.c
int list_unittests = 0;
int daemon = 0;
char *log_dir;
struct stat buf;
/* initialize the logging subsys */
SCLogInitLogModule(NULL);
......
exit(EXIT_SUCCESS);
}
/* Check for the existance of the default logging directory which we pick
* from suricata.yaml. If not found, shut the engine down */
if (ConfGet("default-log-dir", &log_dir) != 1)
log_dir = DEFAULT_LOG_DIR;
if (stat(log_dir, &buf) != 0) {
SCLogError(SC_ERR_STAT_ERROR, "The logging directory \"%s\" picked from "
"suricata.yaml(default-log-dir), doesn't exist. Shutting "
"down the engine", log_dir);
exit(EXIT_FAILURE);
}
/* Since our config is now loaded we can finish configurating the
* logging module. */
SCLogLoadConfig();
src/util-error.h
SC_ERR_NO_URICONTENT_NEGATION,
SC_ERR_FOPEN_ERROR,
SC_ERR_HASH_TABLE_INIT_FAILED,
SC_ERR_STAT_ERROR,
} SCError;
const char *SCErrorToString(SCError);
(3-3/3)