filestore: create file store directory if needed

This patch modifies the file store system to have it create the
file store directory if needed. It dos not create the full
directory tree as the parent directory must have already been
created.
pull/214/head
Eric Leblond 13 years ago
parent 7b1d346c22
commit 412482f6b1

@ -440,10 +440,21 @@ TmEcode LogFilestoreLogThreadInit(ThreadVars *t, void *initdata, void **data)
struct stat stat_buf; struct stat stat_buf;
if (stat(g_logfile_base_dir, &stat_buf) != 0) { if (stat(g_logfile_base_dir, &stat_buf) != 0) {
SCLogError(SC_ERR_LOGDIR_CONFIG, "The file drop directory \"%s\" " int ret;
"supplied doesn't exist. Shutting down the engine", ret = mkdir(g_logfile_base_dir, S_IRWXU|S_IXGRP|S_IRGRP);
g_logfile_base_dir); if (ret != 0) {
exit(EXIT_FAILURE); int err = errno;
if (err != EEXIST) {
SCLogError(SC_ERR_LOGDIR_CONFIG,
"Cannot create file drop directory %s: %s",
g_logfile_base_dir, strerror(err));
exit(EXIT_FAILURE);
}
} else {
SCLogInfo("Created file drop directory %s",
g_logfile_base_dir);
}
} }
*data = (void *)aft; *data = (void *)aft;

Loading…
Cancel
Save