check for the existance of default logging directory

remotes/origin/master-1.0.x
Anoop Saldanha 17 years ago committed by Victor Julien
parent 8189f4d88e
commit 750600ab17

@ -37,6 +37,7 @@
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <netinet/in.h>

@ -300,6 +300,9 @@ int main(int argc, char **argv)
int list_unittests = 0;
int daemon = 0;
char *log_dir;
struct stat buf;
/* initialize the logging subsys */
SCLogInitLogModule(NULL);
@ -445,6 +448,17 @@ int main(int argc, char **argv)
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();

@ -84,6 +84,7 @@ typedef enum {
SC_ERR_NO_URICONTENT_NEGATION,
SC_ERR_FOPEN_ERROR,
SC_ERR_HASH_TABLE_INIT_FAILED,
SC_ERR_STAT_ERROR,
} SCError;
const char *SCErrorToString(SCError);

Loading…
Cancel
Save