|
|
|
@ -106,10 +106,6 @@ int AlertUnifiedAlertWriteFileHeader(ThreadVars *t, AlertUnifiedAlertThread *aun
|
|
|
|
|
int AlertUnifiedAlertCloseFile(ThreadVars *t, AlertUnifiedAlertThread *aun) {
|
|
|
|
|
if (aun->file_ctx->fp != NULL) {
|
|
|
|
|
fclose(aun->file_ctx->fp);
|
|
|
|
|
if (aun->file_ctx->filename != NULL) {
|
|
|
|
|
free(aun->file_ctx->filename);
|
|
|
|
|
aun->file_ctx->filename = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
aun->size_current = 0;
|
|
|
|
|
|
|
|
|
@ -284,7 +280,11 @@ LogFileCtx *AlertUnifiedAlertInitCtx(char *config_file)
|
|
|
|
|
* */
|
|
|
|
|
int AlertUnifiedAlertOpenFileCtx(LogFileCtx *file_ctx, char *config_file)
|
|
|
|
|
{
|
|
|
|
|
char *filename = malloc(PATH_MAX); /* XXX some sane default? */
|
|
|
|
|
char *filename = NULL;
|
|
|
|
|
if (file_ctx->filename != NULL)
|
|
|
|
|
filename = file_ctx->filename;
|
|
|
|
|
else
|
|
|
|
|
filename = file_ctx->filename = malloc(PATH_MAX); /* XXX some sane default? */
|
|
|
|
|
|
|
|
|
|
if (config_file == NULL) {
|
|
|
|
|
/** Separate config files not implemented at the moment,
|
|
|
|
@ -310,7 +310,6 @@ int AlertUnifiedAlertOpenFileCtx(LogFileCtx *file_ctx, char *config_file)
|
|
|
|
|
printf("Error: fopen %s failed: %s\n", filename, strerror(errno)); /* XXX errno threadsafety? */
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
file_ctx->filename = filename;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|